Skip to content

Commit

Permalink
Log codebuild webhook trigger (#13738)
Browse files Browse the repository at this point in the history
* test: log codebuildWebhookTrigger when batch fails

* test: log codebuildWebhookTrigger when batch fails

* test: fix lint and change max-warning to 749

* Revert "test: fix lint and change max-warning to 749"

This reverts commit 3a37c09.

* fix: revert to single-quote to make prettier happy

---------

Co-authored-by: 0.618 <[email protected]>
  • Loading branch information
0618 and 0.618 authored Apr 26, 2024
1 parent cf418f1 commit b8c8e5e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion codebuild_specs/aggregate_e2e_reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion scripts/wait-for-all-codebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion shared-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b8c8e5e

Please sign in to comment.