diff --git a/codebuild_specs/aggregate_e2e_reports.yml b/codebuild_specs/aggregate_e2e_reports.yml index 5ad4191d63a..5b47fe24fee 100644 --- a/codebuild_specs/aggregate_e2e_reports.yml +++ b/codebuild_specs/aggregate_e2e_reports.yml @@ -7,7 +7,7 @@ phases: - cd ./scripts - npm install -g ts-node - npm install aws-sdk - - ts-node ./wait-for-all-codebuild.ts $CODEBUILD_RESOLVED_SOURCE_VERSION ../$WAIT_FOR_IDS_FILE_PATH $PROJECT_NAME + - ts-node ./wait-for-all-codebuild.ts $CODEBUILD_RESOLVED_SOURCE_VERSION ../$WAIT_FOR_IDS_FILE_PATH $PROJECT_NAME $CODEBUILD_WEBHOOK_TRIGGER - cd .. - source ./shared-scripts.sh && _downloadReportsFromS3 $CODEBUILD_SOURCE_VERSION - mkdir artifacts && echo "empty artifact" > artifacts/empty-artifact.txt diff --git a/scripts/wait-for-all-codebuild.ts b/scripts/wait-for-all-codebuild.ts index 7bd2677a148..f8287657cef 100644 --- a/scripts/wait-for-all-codebuild.ts +++ b/scripts/wait-for-all-codebuild.ts @@ -49,7 +49,8 @@ const main = async () => { const expectedSourceVersion = process.argv[2]; const jobsDependedOnFilepathOrId = process.argv[3]; const codeBuildProjectName = process.argv[4]; - let accountForFailures: boolean = process.argv.length >= 6 && process.argv[5] === 'requirePrevJobsToSucceed'; + const codebuildWebhookTrigger = process.argv[5]; + const accountForFailures: boolean = process.argv.length >= 7 && process.argv[6] === 'requirePrevJobsToSucceed'; let jobsDependedOn: string[]; if (fs.existsSync(jobsDependedOnFilepathOrId)) { const jobsDependedOnRaw = fs.readFileSync(jobsDependedOnFilepathOrId, 'utf8'); @@ -84,6 +85,9 @@ const main = async () => { const intersectingFailedJobs = failedJobsInBatch.filter((jobId) => jobsDependedOn.includes(jobId)); console.log(`failedJobsInBatch: ${JSON.stringify(failedJobsInBatch)}`); console.log(`intersectingFailedJobs: ${JSON.stringify(intersectingFailedJobs)}`); + if (failedJobsInBatch.length || intersectingFailedJobs.length) { + console.log(`Batch triggered by ${codebuildWebhookTrigger} failed.`); + } if (intersectingFailedJobs.length > 0) { console.log(`${jobsDependedOn[0]} failed. Exiting.`); process.exit(1); diff --git a/shared-scripts.sh b/shared-scripts.sh index 0f035056693..a57c88511a7 100644 --- a/shared-scripts.sh +++ b/shared-scripts.sh @@ -670,7 +670,7 @@ function _waitForJobs { cd ./scripts npm install -g ts-node npm install aws-sdk - ts-node ./wait-for-all-codebuild.ts $CODEBUILD_RESOLVED_SOURCE_VERSION $file_path $PROJECT_NAME $account_for_failures + ts-node ./wait-for-all-codebuild.ts $CODEBUILD_RESOLVED_SOURCE_VERSION $file_path $PROJECT_NAME $CODEBUILD_WEBHOOK_TRIGGER $account_for_failures cd .. } function _verifyPkgCLI {