-
Notifications
You must be signed in to change notification settings - Fork 44
ci: change s3 cache provider to optimize costs #2344
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 44 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
eaf429c
ci: change s3 backend to decrease costs in tests-rs-package
lklimek 69be7f6
test: comment out some tests to speed up testing - to be reverted
lklimek 18fe6ab
chore: rename S3 vars to CACHE_*
lklimek e5090b5
ci: fix region
lklimek edb98c1
chore: sccache action
lklimek 4edf309
chore: s/env/vars
lklimek 3aa361c
chore: env/vars
lklimek 524b901
chore: minor fixes
lklimek dbacec6
chore: dockerfile typo
lklimek c6ed038
chore: some secrets fixes
lklimek b3200a4
build: dockerfile improvements
lklimek 9d3f8e5
chore: remove aws-actions/configure-aws-credentials@v4
lklimek 3337f59
chore: change how we configure ecr credentials
lklimek 275fac1
chore: add some debug, to be reverted
lklimek 7d3a679
ci: rs-crates-security sccache
lklimek 73fb938
chore: typo
lklimek 4dbff39
chore: debug sccache in gha
lklimek 6e8b28d
chore: fix keys
lklimek c3a7e5d
chore: testing
lklimek e77787e
chore: sccache input rename
lklimek 9c524d2
chore: fix layers push
lklimek e899b18
chore: fix
lklimek edb040c
chore: typo
lklimek 806225f
build: Dockerfile cargo incremental
lklimek 12fe70b
refactor(docker): some renames
lklimek a42f95d
chore: try to unset credentials
lklimek 517a83f
chore: unset aws creds
lklimek a470e8e
chore: unset aws creds, continued
lklimek e6b4de8
chore: unset creds moved to docker
lklimek 4046a2f
chore: update all other files
lklimek 88c2f0a
Revert "test: comment out some tests to speed up testing - to be reve…
lklimek aeb7cb3
chore: remove deprecated set-output
lklimek 9486d0f
chore: comment out aws creds from "Build JS" step
lklimek 358c2c1
Merge remote-tracking branch 'origin/v1.6-dev' into ci/change-s3
lklimek bf4bb7a
fix: invalid region
lklimek e007e83
chore: remove environment
lklimek 601c907
chore: remove test code
lklimek 2893ac0
chore: trigger full workflow run
lklimek 4148f7c
chore: trigger rebuild
lklimek 5f3eb51
chore: rabbit's feedback
lklimek 2fa40cd
chore: apply rabbit feedback
lklimek 9a0a8ce
chore: cleanup ECR login logic
lklimek ecc7396
chore: minor fixes from rabbit
lklimek 0928f49
Merge branch 'v1.6-dev' into ci/change-s3
lklimek f7ffa9a
fix: multi-platform docker build cache misses due to overwriting othe…
lklimek e8bb748
chore: further platform fixes
lklimek 646c830
fix: use the same sccache prefix in gha and docker
lklimek f33c8c7
chore: double-check dockerfile secrets mounts
lklimek ba6507a
refactor: improve readability of aws creds
lklimek d100822
chore: use clang
lklimek 5fbe581
chore: layert cache profile fix
lklimek 6c1bb7a
chore: fix docker
lklimek b910256
chore: fix quotes
lklimek 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,43 @@ | ||
| --- | ||
| # This file contains configuration of aws credentials file. | ||
| # Its primary use is to prepare a credentials file that will be used as a secrets mount when building Docker images. | ||
| name: "aws_credentials" | ||
| description: "Configure .aws/credentials" | ||
| inputs: | ||
| access_key_id: | ||
| description: Access key ID | ||
| required: true | ||
| secret_access_key: | ||
| description: Secret access key | ||
| required: true | ||
| profile: | ||
| description: AWS profile to use | ||
| default: "default" | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Configure AWS credentials | ||
| shell: bash | ||
| run: | | ||
| mkdir -p "${HOME}/.aws" | ||
| cat >> ${HOME}/.aws/credentials << EOF | ||
| [${{ inputs.profile }}] | ||
| aws_access_key_id=${{ inputs.access_key_id }} | ||
| aws_secret_access_key=${{ inputs.secret_access_key }} | ||
| EOF | ||
| chmod -R go-rwx ${HOME}/.aws | ||
lklimek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Set env variables | ||
| shell: bash | ||
| run: | | ||
| # Exit on any error | ||
| set -euo pipefail | ||
| # Validate AWS_PROFILE is not empty | ||
| if [ -z "${{ inputs.profile }}" ]; then | ||
| echo "Error: AWS_PROFILE cannot be empty" | ||
| exit 1 | ||
| fi | ||
| # Export variables | ||
| echo "AWS_PROFILE=${{ inputs.profile }}" >> $GITHUB_ENV | ||
| echo "AWS_SHARED_CREDENTIALS_FILE=${HOME}/.aws/credentials" >> $GITHUB_ENV | ||
lklimek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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,42 @@ | ||
| --- | ||
| # Login to AWS ECR | ||
| name: "aws_ecr_login" | ||
| description: "Login to AWS ECR to store Docker containers" | ||
| inputs: | ||
| aws_account_id: | ||
| description: AWS account ID (AWS_ACCOUNT_ID) | ||
| required: true | ||
| aws_access_key_id: | ||
| description: Access key ID (AWS_ACCESS_KEY_ID) | ||
| required: true | ||
| aws_secret_access_key: | ||
| description: Secret access key (AWS_SECRET_ACCESS_KEY) | ||
| required: true | ||
| aws_region: | ||
| description: AWS region to use (AWS_REGION) | ||
| required: true | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Configure AWS credentials and bucket region | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-access-key-id: ${{ inputs.aws_access_key_id }} | ||
| aws-secret-access-key: ${{ inputs.aws_secret_access_key }} | ||
| aws-region: ${{ inputs.aws_region }} | ||
|
|
||
| - name: Login to ECR | ||
| run: | | ||
| aws ecr get-login-password \ | ||
| --region ${{ inputs.aws_region }} | docker login --username AWS --password-stdin ${{ inputs.aws_account_id }}.dkr.ecr.${{ inputs.aws_region }}.amazonaws.com | ||
| shell: bash | ||
|
|
||
| # Unset AWS credentials to avoid conflicts, as we prefer credentials from ~/.aws/credentials to authenticate | ||
| - name: Unset AWS credentials to avoid conflicts | ||
| shell: bash | ||
| run: | | ||
| echo AWS_DEFAULT_REGION='' >> $GITHUB_ENV | ||
| echo AWS_REGION='' >> $GITHUB_ENV | ||
| echo AWS_ACCESS_KEY_ID='' >> $GITHUB_ENV | ||
| echo AWS_SECRET_ACCESS_KEY='' >> $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
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
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,55 @@ | ||
| --- | ||
| name: "sccache" | ||
| description: "Configure sccache caching" | ||
| inputs: | ||
| bucket: | ||
| description: S3 bucket to use for caching | ||
| required: true | ||
| region: | ||
| description: S3 bucket region | ||
| required: true | ||
| endpoint: | ||
| description: S3 endpoint to use for caching | ||
| required: true | ||
| access_key_id: | ||
| description: S3 endpoint access key ID | ||
| required: true | ||
| secret_access_key: | ||
| description: S3 endpoint secret access key | ||
| required: true | ||
| install: | ||
| description: "Install sccache" | ||
| default: "true" | ||
| version: | ||
| description: "sccache version" | ||
| default: "0.8.2" | ||
| required: false | ||
|
|
||
| # TODO: Cache deps here to save 1 minute | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Install sccache binary | ||
| if: ${{ inputs.install == 'true' }} | ||
| uses: mozilla-actions/[email protected] | ||
| with: | ||
| version: "v${{ inputs.version }}" | ||
|
|
||
| - name: Configure AWS credentials | ||
| uses: ./.github/actions/aws_credentials | ||
| with: | ||
| access_key_id: ${{ inputs.access_key_id }} | ||
| secret_access_key: ${{ inputs.secret_access_key }} | ||
| profile: "sccache" | ||
|
|
||
| - name: Configure sccache | ||
| shell: bash | ||
| run: | | ||
| echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV | ||
| echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | ||
| echo "SCCACHE_BUCKET=${{ inputs.bucket }}" >> $GITHUB_ENV | ||
| echo "SCCACHE_REGION=${{ inputs.region }}" >> $GITHUB_ENV | ||
| echo "SCCACHE_ENDPOINT=${{ inputs.endpoint }}" >> $GITHUB_ENV | ||
| echo "SCCACHE_S3_KEY_PREFIX=${{ runner.os }}/sccache/${{ runner.arch }}/linux-gnu" >> $GITHUB_ENV | ||
lklimek marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # "SCCACHE_VERSION" is used inside Docker to install the same version of sccache | ||
| echo "SCCACHE_VERSION=${{ inputs.version }}" >> $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
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.
Uh oh!
There was an error while loading. Please reload this page.