Skip to content

Commit 5384a19

Browse files
committed
ci: split aws credentials in two separate users with scoped perms
This commit changes our CI to use two separate IAM users to authenticate with AWS: * ci--rust-lang--rust--sccache: has access to the rust-lang-ci-sccache2 S3 bucket and its credentials are available during the whole build. * ci--rust-lang--rust--upload: has access to the rust-lang-ci2 S3 bucket and its credentials are available just during the upload step. The new tokens are available in the `prod-credentials` library.
1 parent 5283791 commit 5384a19

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/ci/azure-pipelines/auto.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trigger:
77
- auto
88

99
variables:
10-
- group: real-prod-credentials
10+
- group: prod-credentials
1111

1212
jobs:
1313
- job: Linux

src/ci/azure-pipelines/master.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trigger:
77
- master
88

99
variables:
10-
- group: real-prod-credentials
10+
- group: prod-credentials
1111

1212
pool:
1313
vmImage: ubuntu-16.04

src/ci/azure-pipelines/steps/run.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ steps:
175175
env:
176176
CI: true
177177
SRC: .
178-
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
178+
AWS_ACCESS_KEY_ID: $(SCCACHE_AWS_ACCESS_KEY_ID)
179+
AWS_SECRET_ACCESS_KEY: $(SCCACHE_AWS_SECRET_ACCESS_KEY)
179180
TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
180181
condition: and(succeeded(), not(variables.SKIP_JOB))
181182
displayName: Run build
@@ -199,7 +200,8 @@ steps:
199200
fi
200201
retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
201202
env:
202-
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
203+
AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID)
204+
AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY)
203205
condition: and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
204206
displayName: Upload artifacts
205207

@@ -208,7 +210,8 @@ steps:
208210
# errors here ever fail the build since this is just informational.
209211
- bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$CI_JOB_NAME.csv
210212
env:
211-
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
212-
condition: variables['AWS_SECRET_ACCESS_KEY']
213+
AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID)
214+
AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY)
215+
condition: variables['UPLOAD_AWS_SECRET_ACCESS_KEY']
213216
continueOnError: true
214217
displayName: Upload CPU usage statistics

src/ci/azure-pipelines/try.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ trigger:
33
- try
44

55
variables:
6-
- group: real-prod-credentials
6+
- group: prod-credentials
77

88
jobs:
99
- job: Linux

0 commit comments

Comments
 (0)