Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log codebuild webhook trigger #13738

Merged
merged 5 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions codebuild_specs/aggregate_e2e_reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ 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
reports:
e2e-reports:
files:
- '*.xml'
file-format: 'JUNITXML'
base-directory: '$CODEBUILD_SRC_DIR/aggregate_reports'
- "*.xml"
file-format: "JUNITXML"
base-directory: "$CODEBUILD_SRC_DIR/aggregate_reports"
artifacts:
files:
- 'artifacts/*'
- "artifacts/*"
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
Loading