From baf11dc2bf4506cc04a2fff31051a42e1ba18768 Mon Sep 17 00:00:00 2001 From: BearHanded Date: Tue, 9 Jul 2024 11:28:38 -0400 Subject: [PATCH 1/4] catch graceful exits with code 1 --- src/runner.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/runner.ts b/src/runner.ts index 03215405..2e287747 100644 --- a/src/runner.ts +++ b/src/runner.ts @@ -102,6 +102,12 @@ export default class LabeledProcessRunner { proc.on("close", (code) => { const paddedPrefix = this.formattedPrefix(prefix); + if (code == 1) { + const errorMessage = `Exit Code Error: ${code}`; + process.stdout.write(`${paddedPrefix} ${errorMessage}\n`); + reject(errorMessage); + return; + } process.stdout.write(`${paddedPrefix} Exit: ${code}\n`); resolve(); }); From c9e09fcdd1794105c2863bb7a23a9264b8fc3084 Mon Sep 17 00:00:00 2001 From: BearHanded Date: Tue, 9 Jul 2024 11:29:42 -0400 Subject: [PATCH 2/4] fail a deploy --- services/ui-src/serverless.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/services/ui-src/serverless.yml b/services/ui-src/serverless.yml index 745b848c..604d2488 100644 --- a/services/ui-src/serverless.yml +++ b/services/ui-src/serverless.yml @@ -32,6 +32,7 @@ custom: - val - production api_region: ${param:ApiRegion, ""} + test_fail: ${ssm:/not_real} api_url: ${param:ApiGatewayRestApiUrl, ""} application_endpoint: ${env:APPLICATION_ENDPOINT, ssm:/${self:custom.stage}/ui/application_endpoint, ssm:/default/ui/application_endpoint} cognito_region: ${param:CognitoRegion, ""} From 7b380e84500d17229d51e42d36102f09b770a505 Mon Sep 17 00:00:00 2001 From: BearHanded Date: Tue, 9 Jul 2024 11:43:30 -0400 Subject: [PATCH 3/4] pass deploy, reformat log --- services/ui-src/serverless.yml | 1 - src/runner.ts | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/services/ui-src/serverless.yml b/services/ui-src/serverless.yml index 604d2488..745b848c 100644 --- a/services/ui-src/serverless.yml +++ b/services/ui-src/serverless.yml @@ -32,7 +32,6 @@ custom: - val - production api_region: ${param:ApiRegion, ""} - test_fail: ${ssm:/not_real} api_url: ${param:ApiGatewayRestApiUrl, ""} application_endpoint: ${env:APPLICATION_ENDPOINT, ssm:/${self:custom.stage}/ui/application_endpoint, ssm:/default/ui/application_endpoint} cognito_region: ${param:CognitoRegion, ""} diff --git a/src/runner.ts b/src/runner.ts index 2e287747..7edb54b7 100644 --- a/src/runner.ts +++ b/src/runner.ts @@ -102,13 +102,11 @@ export default class LabeledProcessRunner { proc.on("close", (code) => { const paddedPrefix = this.formattedPrefix(prefix); + process.stdout.write(`${paddedPrefix} Exit: ${code}\n`); if (code == 1) { - const errorMessage = `Exit Code Error: ${code}`; - process.stdout.write(`${paddedPrefix} ${errorMessage}\n`); - reject(errorMessage); + reject(code); return; } - process.stdout.write(`${paddedPrefix} Exit: ${code}\n`); resolve(); }); }); From ecad87abc2b839c326522e5ae455ba35f218eb3f Mon Sep 17 00:00:00 2001 From: BearHanded Date: Tue, 9 Jul 2024 12:01:57 -0400 Subject: [PATCH 4/4] only allow 0 through --- src/runner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runner.ts b/src/runner.ts index 7edb54b7..68336d34 100644 --- a/src/runner.ts +++ b/src/runner.ts @@ -103,7 +103,7 @@ export default class LabeledProcessRunner { proc.on("close", (code) => { const paddedPrefix = this.formattedPrefix(prefix); process.stdout.write(`${paddedPrefix} Exit: ${code}\n`); - if (code == 1) { + if (code != 0) { reject(code); return; }