From 00c44af970044be9d08de638d52bce98ca786917 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 18 Sep 2019 11:10:46 +0200 Subject: [PATCH] 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. --- src/ci/azure-pipelines/auto.yml | 2 +- src/ci/azure-pipelines/master.yml | 2 +- src/ci/azure-pipelines/steps/run.yml | 8 +++++--- src/ci/azure-pipelines/try.yml | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ci/azure-pipelines/auto.yml b/src/ci/azure-pipelines/auto.yml index 1656066eb29c9..5f7761297095c 100644 --- a/src/ci/azure-pipelines/auto.yml +++ b/src/ci/azure-pipelines/auto.yml @@ -7,7 +7,7 @@ trigger: - auto variables: -- group: real-prod-credentials +- group: prod-credentials jobs: - job: Linux diff --git a/src/ci/azure-pipelines/master.yml b/src/ci/azure-pipelines/master.yml index 9742c71965851..e2baa923d99f7 100644 --- a/src/ci/azure-pipelines/master.yml +++ b/src/ci/azure-pipelines/master.yml @@ -7,7 +7,7 @@ trigger: - master variables: -- group: real-prod-credentials +- group: prod-credentials pool: vmImage: ubuntu-16.04 diff --git a/src/ci/azure-pipelines/steps/run.yml b/src/ci/azure-pipelines/steps/run.yml index da0a899ac85eb..51a8c167afc9f 100644 --- a/src/ci/azure-pipelines/steps/run.yml +++ b/src/ci/azure-pipelines/steps/run.yml @@ -175,7 +175,8 @@ steps: env: CI: true SRC: . - AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY) + AWS_ACCESS_KEY_ID: $(SCCACHE_AWS_ACCESS_KEY_ID) + AWS_SECRET_ACCESS_KEY: $(SCCACHE_AWS_SECRET_ACCESS_KEY) TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN) condition: and(succeeded(), not(variables.SKIP_JOB)) displayName: Run build @@ -208,7 +209,8 @@ steps: # errors here ever fail the build since this is just informational. - bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$CI_JOB_NAME.csv env: - AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY) - condition: variables['AWS_SECRET_ACCESS_KEY'] + AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID) + AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY) + condition: variables['UPLOAD_AWS_SECRET_ACCESS_KEY'] continueOnError: true displayName: Upload CPU usage statistics diff --git a/src/ci/azure-pipelines/try.yml b/src/ci/azure-pipelines/try.yml index 0df6c6c951f24..c919b1023a0eb 100644 --- a/src/ci/azure-pipelines/try.yml +++ b/src/ci/azure-pipelines/try.yml @@ -3,7 +3,7 @@ trigger: - try variables: -- group: real-prod-credentials +- group: prod-credentials jobs: - job: Linux