Skip to content

Commit

Permalink
Improve Bash Deployment Scripts for Robust Error Handling (#200)
Browse files Browse the repository at this point in the history
### Summary & Motivation

Address error handling in infrastructure Bash deployment scripts to
correct the issue where the output of Bicep commands piped to `tee
/dev/tty` fails in non-interactive environments. Modify the piping to
`2>&1` to capture both `stdout` and `stderr` reliably across different
contexts.

Introduce `#!/bin/bash` shebang to all infrastructure scripts to
standardize execution behavior and formatting, aligning the local
terminal experience with that of GitHub Actions.

### Checklist

- [x] I have added a Label to the pull-request
- [x] I have added tests, and done manual regression tests
- [x] I have updated the documentation, if necessary
  • Loading branch information
tjementum authored Nov 8, 2023
2 parents a0bc630 + ffdc26d commit a1f1992
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

ENVIRONMENT="development"
LOCATION="WestEurope"
LOCATION_PREFIX="west-europe"
Expand Down
2 changes: 2 additions & 0 deletions cloud-infrastructure/cluster/config/production-west-europe.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

ENVIRONMENT="production"
LOCATION="WestEurope"
LOCATION_PREFIX="west-europe"
Expand Down
2 changes: 2 additions & 0 deletions cloud-infrastructure/cluster/config/staging-west-europe.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

ENVIRONMENT="staging"
LOCATION="WestEurope"
LOCATION_PREFIX="west-europe"
Expand Down
2 changes: 1 addition & 1 deletion cloud-infrastructure/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ fi
if [[ "$*" == *"--apply"* ]]
then
echo "$(date +"%Y-%m-%dT%H:%M:%S") Applying changes..."
export output=$($DEPLOYMENT_COMMAND $DEPLOYMENT_PARAMETERS | tee /dev/tty)
export output=$($DEPLOYMENT_COMMAND $DEPLOYMENT_PARAMETERS 2>&1)
fi
2 changes: 2 additions & 0 deletions cloud-infrastructure/environment/config/development.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

ENVIRONMENT="development"
LOCATION="WestEurope"

Expand Down
2 changes: 2 additions & 0 deletions cloud-infrastructure/environment/config/production.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

ENVIRONMENT="production"
LOCATION="WestEurope"

Expand Down
2 changes: 2 additions & 0 deletions cloud-infrastructure/environment/config/staging.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

ENVIRONMENT="staging"
LOCATION="WestEurope"

Expand Down
1 change: 1 addition & 0 deletions cloud-infrastructure/shared/config/shared-development.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash

ENVIRONMENT="development"
LOCATION="WestEurope"
Expand Down
2 changes: 2 additions & 0 deletions cloud-infrastructure/shared/config/shared.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

ENVIRONMENT="production"
LOCATION="WestEurope"

Expand Down

0 comments on commit a1f1992

Please sign in to comment.