Skip to content

Commit 0cc8955

Browse files
committed
CCM-11029: error handling in pre.sh
1 parent bc6e045 commit 0cc8955

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

infrastructure/terraform/bin/terraform.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ rm -rf ${component_path}/.terraform;
391391

392392
# Run global pre.sh
393393
if [ -f "pre.sh" ]; then
394-
source pre.sh "${region}" "${environment}" "${action}" \
394+
bash pre.sh "${region}" "${environment}" "${action}" \
395395
|| error_and_die "Global pre script execution failed with exit code ${?}";
396396
fi;
397397

@@ -427,7 +427,7 @@ fi;
427427

428428
# Run pre.sh
429429
if [ -f "pre.sh" ]; then
430-
source pre.sh "${region}" "${environment}" "${action}" \
430+
bash pre.sh "${region}" "${environment}" "${action}" \
431431
|| error_and_die "Component pre script execution failed with exit code ${?}";
432432
fi;
433433

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
echo "Running app pre.sh"
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
24

3-
original_dir=$(pwd)
5+
echo "Running app pre.sh"
46

57
cd $(git rev-parse --show-toplevel)
68

@@ -11,5 +13,3 @@ npm run generate-dependencies --workspaces --if-present
1113
npm run lambda-build --workspaces --if-present
1214

1315
$(git rev-parse --show-toplevel)/lambdas/layers/pdfjs/build.sh
14-
15-
cd $original_dir

infrastructure/terraform/components/sandbox/pre.sh

100644100755
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
15
REGION=$1
26
ENVIRONMENT=$2
37
ACTION=$3
@@ -10,7 +14,6 @@ echo "SKIP_SANDBOX_INSTALL=$SKIP_SANDBOX_INSTALL"
1014

1115

1216
if [ "${ACTION}" == "apply" ]; then
13-
original_dir=$(pwd)
1417
cd $(git rev-parse --show-toplevel)
1518
echo "Building lambdas for distribution"
1619

@@ -27,7 +30,6 @@ if [ "${ACTION}" == "apply" ]; then
2730

2831
$(git rev-parse --show-toplevel)/lambdas/layers/pdfjs/build.sh
2932

30-
cd $original_dir
3133
else
3234
echo "Skipping lambda build for action $ACTION"
3335
fi

0 commit comments

Comments
 (0)