Skip to content

Commit e1aa3fc

Browse files
committed
test error handling
1 parent 7a67d1a commit e1aa3fc

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

.controlplane/controlplane.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ aliases:
1414
# Production apps will use a different org than staging for security.
1515
# Change this value to your org name
1616
# or set ENV CPLN_ORG to your org name as that will override whatever is used here for all cpl commands
17-
# cpln_org: shakacode-open-source-examples
17+
cpln_org: shakacode-open-source-examples-staging
1818

1919
# Example apps use only location. CPLN offers the ability to use multiple locations.
2020
default_location: aws-us-east-2

.controlplane/release_script.sh

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
#!/bin/bash -e
22

3-
echo 'Running release_script.sh per controlplane.yml'
43

5-
echo 'Run DB migrations'
6-
./bin/rails db:prepare
4+
log() {
5+
echo "[`date +%Y-%m-%d:%H:%M:%S`]: $1"
6+
}
77

8-
echo 'Completed release_script.sh per controlplane.yml'
8+
error_exit() {
9+
log "$1" 1>&2
10+
exit 1
11+
}
12+
13+
# Test error!
14+
error_exit
15+
16+
log 'Running release_script.sh per controlplane.yml'
17+
18+
if [ -x ./bin/rails ]; then
19+
log 'Run DB migrations'
20+
./bin/rails db:prepare || error_exit "Failed to run DB migrations"
21+
else
22+
error_exit "./bin/rails does not exist or is not executable"
23+
fi
24+
25+
log 'Completed release_script.sh per controlplane.yml'

0 commit comments

Comments
 (0)