@@ -201,37 +201,21 @@ steps:
201201 condition : and(succeeded(), not(variables.SKIP_JOB))
202202 displayName : Run build
203203
204- # If we're a deploy builder, use the `aws` command to publish everything to our
205- # bucket.
206- - bash : |
207- set -e
208- source src/ci/shared.sh
209- if [ "$AGENT_OS" = "Linux" ]; then
210- rm -rf obj/build/dist/doc
211- upload_dir=obj/build/dist
212- else
213- rm -rf build/dist/doc
214- upload_dir=build/dist
215- fi
216- ls -la $upload_dir
217- deploy_dir=rustc-builds
218- if [ "$DEPLOY_ALT" == "1" ]; then
219- deploy_dir=rustc-builds-alt
220- fi
221- retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
204+ - bash : src/ci/scripts/upload-artifacts.sh
222205 env :
223206 AWS_ACCESS_KEY_ID : $(UPLOAD_AWS_ACCESS_KEY_ID)
224207 AWS_SECRET_ACCESS_KEY : $(UPLOAD_AWS_SECRET_ACCESS_KEY)
225- condition : and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
226208 displayName : Upload artifacts
227-
228- # Upload CPU usage statistics that we've been gathering this whole time. Always
229- # execute this step in case we want to inspect failed builds, but don't let
230- # errors here ever fail the build since this is just informational.
231- - bash : aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$CI_JOB_NAME.csv
232- env :
233- AWS_ACCESS_KEY_ID : $(UPLOAD_AWS_ACCESS_KEY_ID)
234- AWS_SECRET_ACCESS_KEY : $(UPLOAD_AWS_SECRET_ACCESS_KEY)
235- condition : variables['UPLOAD_AWS_SECRET_ACCESS_KEY']
236- continueOnError : true
237- displayName : Upload CPU usage statistics
209+ # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
210+ # builders *should* have the AWS credentials available. Still, explicitly
211+ # adding the condition is helpful as this way CI will not silently skip
212+ # deploying artifacts from a dist builder if the variables are misconfigured,
213+ # erroring about invalid credentials instead.
214+ condition : |
215+ and(
216+ succeeded(), not(variables.SKIP_JOB),
217+ or(
218+ variables.UPLOAD_AWS_SECRET_ACCESS_KEY,
219+ eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')
220+ )
221+ )
0 commit comments