@@ -183,37 +183,21 @@ steps:
183183  condition : and(succeeded(), not(variables.SKIP_JOB)) 
184184  displayName : Run build 
185185
186- #  If we're a deploy builder, use the `aws` command to publish everything to our
187- #  bucket.
188- - bash : | 
189-     set -e 
190-     source src/ci/shared.sh 
191-     if [ "$AGENT_OS" = "Linux" ]; then 
192-         rm -rf obj/build/dist/doc 
193-         upload_dir=obj/build/dist 
194-     else 
195-         rm -rf build/dist/doc 
196-         upload_dir=build/dist 
197-     fi 
198-     ls -la $upload_dir 
199-     deploy_dir=rustc-builds 
200-     if [ "$DEPLOY_ALT" == "1" ]; then 
201-         deploy_dir=rustc-builds-alt 
202-     fi 
203-     retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION 
186+ - bash : src/ci/scripts/upload-artifacts.sh 
204187  env :
205188    AWS_ACCESS_KEY_ID : $(UPLOAD_AWS_ACCESS_KEY_ID) 
206189    AWS_SECRET_ACCESS_KEY : $(UPLOAD_AWS_SECRET_ACCESS_KEY) 
207-   condition : and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1'))) 
208190  displayName : Upload artifacts 
209- 
210- #  Upload CPU usage statistics that we've been gathering this whole time. Always
211- #  execute this step in case we want to inspect failed builds, but don't let
212- #  errors here ever fail the build since this is just informational.
213- - bash : aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$CI_JOB_NAME.csv 
214-   env :
215-     AWS_ACCESS_KEY_ID : $(UPLOAD_AWS_ACCESS_KEY_ID) 
216-     AWS_SECRET_ACCESS_KEY : $(UPLOAD_AWS_SECRET_ACCESS_KEY) 
217-   condition : variables['UPLOAD_AWS_SECRET_ACCESS_KEY'] 
218-   continueOnError : true 
219-   displayName : Upload CPU usage statistics 
191+   #  Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
192+   #  builders *should* have the AWS credentials available. Still, explicitly
193+   #  adding the condition is helpful as this way CI will not silently skip
194+   #  deploying artifacts from a dist builder if the variables are misconfigured,
195+   #  erroring about invalid credentials instead.
196+   condition : | 
197+     and( 
198+       succeeded(), not(variables.SKIP_JOB), 
199+       or( 
200+         variables.UPLOAD_AWS_SECRET_ACCESS_KEY, 
201+         eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1') 
202+       ) 
203+     ) 
0 commit comments