-
Notifications
You must be signed in to change notification settings - Fork 193
[worker] Add worker from turtle-v2 #3268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
81ddd8a
Copy files to here
sjchmiela b3a1fc4
Update `package.json` and `yarn.lock`
sjchmiela a120c75
Add `@expo/rudder-sdk-node`
sjchmiela 1a24cd1
Fix `tsconfig.json`
sjchmiela 8eac515
Simplify direnv setup
sjchmiela 0716f66
Remove obsolete assets
sjchmiela 26532fe
# This is a combination of 2 commits.
sjchmiela 26a164c
Fix `getAccessedEnvs`, `env` and `Environment`
sjchmiela 679a0b7
Import test utils
sjchmiela 5c2268a
Migrate from `promise.sleep` to `timers/promises`
sjchmiela fe3a4b0
Remove notion of `priority`
sjchmiela 5551a0b
Fix Sentry integration
sjchmiela a31ed04
Import `ResourceClass` and image info
sjchmiela e41ed13
Remove `ExitHandler`
sjchmiela 1d711df
Import `errorMiddleware`
sjchmiela d7f65d3
Import `WebSocketServer`
sjchmiela 1620fa8
Import `LauncherMessage`, `WorkerMessage` and `Worker`
sjchmiela 17ce4d3
Import logger
sjchmiela f39ff87
Import `turtleFetch`
sjchmiela 9a817bc
Fix `.eslintrc.json`
sjchmiela 840533b
Add dependencies missing from `package.json`
sjchmiela b00340e
Adjust code for missing `no-floating-promises` ESLint rule
sjchmiela 3422fc9
Adjust `.eslintrc.js`
sjchmiela 27402a2
Fix ESLint problems
sjchmiela 045976f
Update `@types/tar` to fix `minipass` problem
sjchmiela 5cffe5a
Fix test setup
sjchmiela f497e27
Remove unused build.ts file
sjchmiela 75c5e8c
Adapt `build-and-deploy-worker.yml`
sjchmiela c427b51
Add `expo-cocoapods-proxy`
sjchmiela 4990d99
Adjust `package.sh`
sjchmiela c0bddd4
Fixup `setup-gcloud`
sjchmiela edcd1fd
Bump packages
sjchmiela 5effe7d
Fix GCP authentication means
sjchmiela c0679a8
Fix src/services/worker/dist expectation from launcher
sjchmiela bb4f542
Apply #2434 from turtle-v2
sjchmiela c1786d6
Apply #2436 from turtle-v2
sjchmiela 3ba4617
Add `worker.yml`
sjchmiela 7be83cb
Cleanup `.envrc`
sjchmiela 52352a4
Use real secrets for integration tests
sjchmiela 90570e4
Move `Environment` to `constants`
sjchmiela 0ea8720
Fix `abortBuild` test
sjchmiela 9e4706b
Update packages/expo-cocoapods-proxy/expo-cocoapods-proxy.gemspec
sjchmiela 1012108
Fixup
sjchmiela File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| name: direnv | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Download direnv | ||
| shell: bash | ||
| run: | | ||
| # inside of a container you are probably already root | ||
| # and sudo is not available | ||
| if [ "$EUID" -ne 0 ]; then | ||
| SUDO=sudo | ||
| fi | ||
|
|
||
| os="$(uname | tr '[:upper:]' '[:lower:]')" | ||
| arch="$(uname -m)" | ||
| if [ "$arch" = 'x86_64' ]; then | ||
| arch='amd64' | ||
| fi | ||
|
|
||
| curl -L -o /tmp/direnv "https://github.com/direnv/direnv/releases/download/v2.32.1/direnv.$os-$arch" | ||
| chmod +x /tmp/direnv | ||
| $SUDO mv /tmp/direnv /usr/local/bin/direnv | ||
|
|
||
| - name: Allow dirs | ||
| shell: bash | ||
| run: | | ||
| config_file="$HOME/.config/direnv/direnv.toml" | ||
| mkdir -p $(dirname "$config_file") | ||
| cat <<- EOF > "$config_file" | ||
| [global] | ||
| strict_env = true | ||
| [whitelist] | ||
| prefix = [ "$GITHUB_WORKSPACE" ] | ||
| EOF | ||
|
|
||
| - name: Load env | ||
| shell: bash | ||
| run: | | ||
| direnv_path_value="$(direnv exec . sh -c 'echo $PATH')" | ||
| IFS=: # loop over PATH entries, which are separated by ":" | ||
| for direnv_path_entry in $(echo "$direnv_path_value"); do | ||
| if ! echo "$PATH" | grep "$direnv_path_entry" &> /dev/null; then | ||
| echo "GITHUB_PATH does not include $direnv_path_entry, adding now" | ||
| echo "$direnv_path_entry" >> "$GITHUB_PATH" | ||
| fi | ||
| done | ||
| direnv export gha >> "$GITHUB_ENV" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| name: setup-gcloud | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Auth gcloud | ||
| uses: google-github-actions/auth@v2 | ||
| with: | ||
| workload_identity_provider: 'projects/321830142373/locations/global/workloadIdentityPools/github/providers/expo' | ||
| project_id: exponentjs | ||
|
|
||
| - name: Setup gcloud | ||
| uses: google-github-actions/setup-gcloud@e427ad8a34f8676edf47cf7d7925499adf3eb74f # v2 | ||
| with: | ||
| version: 548.0.0 | ||
| project_id: exponentjs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| name: build-and-deploy-worker | ||
| # If environment is empty we want to build (for testing) | ||
| # and upload (if on `main`, for later deployment). | ||
| # If environment is not empty, we want to build and upload (unless | ||
| # already uploaded) and deploy. | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| environment: | ||
| description: '"staging", "production" or empty' | ||
| type: string | ||
| required: true | ||
| workflow_call: | ||
| inputs: | ||
| environment: | ||
| description: '"staging", "production" or empty' | ||
| type: string | ||
| required: true | ||
|
|
||
| jobs: | ||
| setup: | ||
| runs-on: ubuntu-latest | ||
| if: inputs.environment != '' | ||
| outputs: | ||
| needs-to-build: ${{ steps.check_worker_exists.outputs.worker_exists == 'false' }} | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | ||
|
|
||
| - uses: ./.github/internal-actions/setup-gcloud | ||
|
|
||
| - name: Check if worker already exists | ||
| id: check_worker_exists | ||
| run: | | ||
| for platform in android ios; do | ||
| GCP_TARBALL="worker-$platform-sha1-$GITHUB_SHA.tar.gz" | ||
|
|
||
| if ! gsutil stat gs://eas-build-worker-tarballs/$GCP_TARBALL; then | ||
| echo "worker_exists=false" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
| done | ||
|
|
||
| echo "worker_exists=true" >> "$GITHUB_OUTPUT" | ||
|
|
||
| build: | ||
| runs-on: ${{ matrix.runner.name }} | ||
| needs: | ||
| - setup | ||
| if: (!failure() && !cancelled() && inputs.environment == '') || needs.setup.outputs.needs-to-build == 'true' | ||
| permissions: | ||
| id-token: write | ||
| strategy: | ||
| matrix: | ||
| runner: | ||
| - name: ubuntu-latest | ||
| platform: android | ||
| - name: macos-latest | ||
| platform: ios | ||
| steps: | ||
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | ||
|
|
||
| - uses: volta-cli/action@5c175f92dea6f48441c436471e6479dbc192e194 # v4 | ||
|
|
||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: "2.7" | ||
|
|
||
| - name: Install coreutils (macOS only) | ||
| if: runner.os == 'macOS' | ||
| run: brew install coreutils | ||
|
|
||
| - name: Build worker tarball | ||
| working-directory: packages/worker | ||
| run: ./package.sh worker-${{ matrix.runner.platform }}.tar.gz ${{ matrix.runner.platform }} | ||
|
|
||
| - uses: ./.github/internal-actions/setup-gcloud | ||
|
|
||
| - name: Upload worker tarballs to GCP | ||
| if: github.ref == 'refs/heads/main' || inputs.environment != '' | ||
| working-directory: packages/worker | ||
| run: | | ||
| ARTIFACT_TARBALL="worker-${{ matrix.runner.platform }}.tar.gz" | ||
| GCP_TARBALL="worker-${{ matrix.runner.platform }}-sha1-$GITHUB_SHA.tar.gz" | ||
|
|
||
| gsutil cp $ARTIFACT_TARBALL gs://eas-build-worker-tarballs/$GCP_TARBALL | ||
|
|
||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - setup | ||
| - build | ||
| if: (!failure() && !cancelled() && inputs.environment != '') | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | ||
|
|
||
| - uses: ./.github/internal-actions/setup-gcloud | ||
|
|
||
| - name: Promote worker to ${{ inputs.environment }} | ||
| run: | | ||
| for platform in android ios; do | ||
| GCP_TARBALL="worker-$platform-sha1-$GITHUB_SHA.tar.gz" | ||
| WORKER_STAGING_TARBALL="worker-$platform-${{ inputs.environment }}.tar.gz" | ||
|
|
||
| gsutil cp gs://eas-build-worker-tarballs/$GCP_TARBALL gs://eas-build-worker-tarballs/$WORKER_STAGING_TARBALL | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| name: worker | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'packages/worker/**' | ||
| - .github/workflows/worker.yml | ||
| - .github/workflows/build-and-deploy-worker.yml | ||
| pull_request: | ||
| paths: | ||
| - 'packages/worker/**' | ||
| - .github/workflows/worker.yml | ||
| - .github/workflows/build-and-deploy-worker.yml | ||
|
|
||
| jobs: | ||
| worker-android-checks: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| NODE_OPTIONS: '--max_old_space_size=3072' | ||
| JAVA_OPTS: '-Xms512m -Xmx2g' | ||
| GRADLE_OPTS: '-Xmx2g -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx2g -XX:+HeapDumpOnOutOfMemoryError"' | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | ||
|
|
||
| - uses: ./.github/internal-actions/setup-gcloud | ||
|
|
||
| - uses: ./.github/internal-actions/direnv | ||
|
|
||
| - uses: volta-cli/action@5c175f92dea6f48441c436471e6479dbc192e194 # v4 | ||
|
|
||
| - run: yarn install --frozen-lockfile --check-files | ||
|
|
||
| - name: Run integration tests | ||
| working-directory: packages/worker | ||
| run: direnv exec .direnv/test ./resources/ci-linux-integration-test.sh | ||
|
|
||
| worker-ios-checks: | ||
| runs-on: macos-latest | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | ||
|
|
||
| - uses: ./.github/internal-actions/setup-gcloud | ||
|
|
||
| - uses: ./.github/internal-actions/direnv | ||
|
|
||
| - uses: volta-cli/action@5c175f92dea6f48441c436471e6479dbc192e194 # v4 | ||
|
|
||
| - run: yarn install --frozen-lockfile --check-files | ||
|
|
||
| - name: Run integration tests | ||
| working-directory: packages/worker | ||
| run: direnv exec .direnv/test ./resources/ci-macos-integration-test.sh | ||
|
|
||
| worker-build: | ||
| uses: ./.github/workflows/build-and-deploy-worker.yml | ||
| secrets: inherit | ||
| with: | ||
| environment: '' | ||
|
|
||
| deploy-worker-staging: | ||
| if: github.ref == 'refs/heads/main' | ||
| needs: | ||
| - worker-build | ||
| - worker-ios-checks | ||
| - worker-android-checks | ||
| uses: ./.github/workflows/build-and-deploy-worker.yml | ||
| secrets: inherit | ||
| with: | ||
| environment: staging | ||
|
|
||
| # deploy-worker-production: | ||
| # if: github.ref == 'refs/heads/main' && !failure() && !cancelled() | ||
| # needs: | ||
| # - deploy-worker-staging | ||
| # uses: ./.github/workflows/build-and-deploy-worker.yml | ||
| # secrets: inherit | ||
| # with: | ||
| # environment: production | ||
|
|
||
| # notify-slack: | ||
| # runs-on: expo-small | ||
| # needs: | ||
| # - deploy-worker-production | ||
| # if: github.ref == 'refs/heads/main' && always() && !cancelled() | ||
| # steps: | ||
| # - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | ||
|
|
||
| # - name: Notify Slack | ||
| # uses: ./.github/actions/notify-slack-on-fail-or-recover | ||
| # with: | ||
| # channel: turtle-bots | ||
| # slack_token: ${{ secrets.SLACK_API_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /.bundle/ | ||
| /.yardoc | ||
| /_yardoc/ | ||
| /coverage/ | ||
| /doc/ | ||
| /pkg/ | ||
| /spec/reports/ | ||
| /tmp/ | ||
|
|
||
| # rspec failure tracking | ||
| .rspec_status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| --format documentation | ||
| --color | ||
| --require spec_helper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Metrics/BlockLength: | ||
| Exclude: | ||
| - "spec/**/*" | ||
| Lint/AmbiguousBlockAssociation: | ||
| Exclude: | ||
| - "spec/**/*" | ||
| Metrics/MethodLength: | ||
| Max: 20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| source 'https://rubygems.org' | ||
|
|
||
| git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } | ||
|
|
||
| # Specify your gem's dependencies in expo-cocoapods-proxy.gemspec | ||
| gemspec | ||
|
|
||
| gem 'rubocop', '~> 1.48', group: :development | ||
|
|
||
| gem 'cocoapods', '~> 1.12' |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears this is the first time
gs://eas-build-worker-tarballshas been publicly exposed.I reviewed the bucket’s access policy and it looks safe.
Adding a note here as this does expand our attack surface.