From 71cf6674eb42711157f3bb22bf93c44475495c2e Mon Sep 17 00:00:00 2001 From: "0.618" Date: Thu, 25 Apr 2024 15:47:22 -0700 Subject: [PATCH 1/5] test: log codebuildWebhookTrigger when batch fails --- codebuild_specs/aggregate_e2e_reports.yml | 2 +- scripts/wait-for-all-codebuild.ts | 6 +++++- shared-scripts.sh | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) 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 { From c8cf201fab7b65f0a692164daacf2a72ad00ae14 Mon Sep 17 00:00:00 2001 From: "0.618" Date: Thu, 25 Apr 2024 15:48:18 -0700 Subject: [PATCH 2/5] test: log codebuildWebhookTrigger when batch fails --- codebuild_specs/aggregate_e2e_reports.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/codebuild_specs/aggregate_e2e_reports.yml b/codebuild_specs/aggregate_e2e_reports.yml index 5b47fe24fee..90680ffbe80 100644 --- a/codebuild_specs/aggregate_e2e_reports.yml +++ b/codebuild_specs/aggregate_e2e_reports.yml @@ -14,9 +14,9 @@ phases: 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/*" From 3a37c09aabee064b8de748ff94dd2d7c1cc84015 Mon Sep 17 00:00:00 2001 From: "0.618" Date: Fri, 26 Apr 2024 09:36:27 -0700 Subject: [PATCH 3/5] test: fix lint and change max-warning to 749 --- package.json | 2 +- .../amplify-graphql-resource-manager.ts | 2 +- packages/amplify-util-mock/src/api/api.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9537a46a00f..d8d25c81033 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "link-dev": "mkdir -p .bin/ && cd packages/amplify-cli && ln -s \"$(pwd)/bin/amplify\" ../../.bin/amplify-dev && cd ../../", "link-win": "node ./scripts/link-bin.js packages/amplify-cli/bin/amplify amplify-dev", "lint-check-package-json": "yarn eslint --no-eslintrc --config .eslint.package.json.js '**/package.json'", - "lint-check": "yarn eslint . --ext .js,.jsx,.ts,.tsx --max-warnings=750", + "lint-check": "yarn eslint . --ext .js,.jsx,.ts,.tsx --max-warnings=749", "lint-fix-package-json": "yarn lint-check-package-json --fix", "lint-fix": "git diff --name-only --cached --diff-filter d | grep -E '\\.(js|jsx|ts|tsx)$' | xargs eslint --fix --quiet", "mergewords": "yarn ts-node ./scripts/handle-dict-conflicts.ts", diff --git a/packages/amplify-provider-awscloudformation/src/graphql-resource-manager/amplify-graphql-resource-manager.ts b/packages/amplify-provider-awscloudformation/src/graphql-resource-manager/amplify-graphql-resource-manager.ts index 1e11b4be5f0..5ebcb15d083 100644 --- a/packages/amplify-provider-awscloudformation/src/graphql-resource-manager/amplify-graphql-resource-manager.ts +++ b/packages/amplify-provider-awscloudformation/src/graphql-resource-manager/amplify-graphql-resource-manager.ts @@ -464,7 +464,7 @@ export class GraphQLResourceManager { /** * Remove all outputs and resources except for search domain for searchable stack - * @param template stack CFN tempalte + * @param template stack CFN template */ private dropTemplateResourcesForSearchableStack = (template: Template): void => { const OpenSearchDomainLogicalID = 'OpenSearchDomain'; diff --git a/packages/amplify-util-mock/src/api/api.ts b/packages/amplify-util-mock/src/api/api.ts index 861e5627d47..4a99b9c25aa 100644 --- a/packages/amplify-util-mock/src/api/api.ts +++ b/packages/amplify-util-mock/src/api/api.ts @@ -94,7 +94,7 @@ export class APITest { await this.generateCode(context, appSyncConfig); context.print.info(`AppSync Mock endpoint is running at ${this.appSyncSimulator.url}`); - context.print.info(`GraphiQL IDE is available for local testing at ${this.appSyncSimulator.localhostUrl}`); + context.print.info(`GraphQL IDE is available for local testing at ${this.appSyncSimulator.localhostUrl}`); await this.startDDBListeners(context, appSyncConfig, false); } catch (e) { const errMessage = 'Failed to start API Mocking.'; From 44dfdca1f69c5e335fc15f80f7fe7195a39b6009 Mon Sep 17 00:00:00 2001 From: "0.618" Date: Fri, 26 Apr 2024 10:09:45 -0700 Subject: [PATCH 4/5] Revert "test: fix lint and change max-warning to 749" This reverts commit 3a37c09aabee064b8de748ff94dd2d7c1cc84015. --- package.json | 2 +- .../amplify-graphql-resource-manager.ts | 2 +- packages/amplify-util-mock/src/api/api.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d8d25c81033..9537a46a00f 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "link-dev": "mkdir -p .bin/ && cd packages/amplify-cli && ln -s \"$(pwd)/bin/amplify\" ../../.bin/amplify-dev && cd ../../", "link-win": "node ./scripts/link-bin.js packages/amplify-cli/bin/amplify amplify-dev", "lint-check-package-json": "yarn eslint --no-eslintrc --config .eslint.package.json.js '**/package.json'", - "lint-check": "yarn eslint . --ext .js,.jsx,.ts,.tsx --max-warnings=749", + "lint-check": "yarn eslint . --ext .js,.jsx,.ts,.tsx --max-warnings=750", "lint-fix-package-json": "yarn lint-check-package-json --fix", "lint-fix": "git diff --name-only --cached --diff-filter d | grep -E '\\.(js|jsx|ts|tsx)$' | xargs eslint --fix --quiet", "mergewords": "yarn ts-node ./scripts/handle-dict-conflicts.ts", diff --git a/packages/amplify-provider-awscloudformation/src/graphql-resource-manager/amplify-graphql-resource-manager.ts b/packages/amplify-provider-awscloudformation/src/graphql-resource-manager/amplify-graphql-resource-manager.ts index 5ebcb15d083..1e11b4be5f0 100644 --- a/packages/amplify-provider-awscloudformation/src/graphql-resource-manager/amplify-graphql-resource-manager.ts +++ b/packages/amplify-provider-awscloudformation/src/graphql-resource-manager/amplify-graphql-resource-manager.ts @@ -464,7 +464,7 @@ export class GraphQLResourceManager { /** * Remove all outputs and resources except for search domain for searchable stack - * @param template stack CFN template + * @param template stack CFN tempalte */ private dropTemplateResourcesForSearchableStack = (template: Template): void => { const OpenSearchDomainLogicalID = 'OpenSearchDomain'; diff --git a/packages/amplify-util-mock/src/api/api.ts b/packages/amplify-util-mock/src/api/api.ts index 4a99b9c25aa..861e5627d47 100644 --- a/packages/amplify-util-mock/src/api/api.ts +++ b/packages/amplify-util-mock/src/api/api.ts @@ -94,7 +94,7 @@ export class APITest { await this.generateCode(context, appSyncConfig); context.print.info(`AppSync Mock endpoint is running at ${this.appSyncSimulator.url}`); - context.print.info(`GraphQL IDE is available for local testing at ${this.appSyncSimulator.localhostUrl}`); + context.print.info(`GraphiQL IDE is available for local testing at ${this.appSyncSimulator.localhostUrl}`); await this.startDDBListeners(context, appSyncConfig, false); } catch (e) { const errMessage = 'Failed to start API Mocking.'; From bfaaa4d2b0c9fe195add484b9392a92e7adee1c9 Mon Sep 17 00:00:00 2001 From: "0.618" Date: Fri, 26 Apr 2024 10:14:23 -0700 Subject: [PATCH 5/5] fix: revert to single-quote to make prettier happy --- codebuild_specs/aggregate_e2e_reports.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/codebuild_specs/aggregate_e2e_reports.yml b/codebuild_specs/aggregate_e2e_reports.yml index 90680ffbe80..5b47fe24fee 100644 --- a/codebuild_specs/aggregate_e2e_reports.yml +++ b/codebuild_specs/aggregate_e2e_reports.yml @@ -14,9 +14,9 @@ phases: 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/*'