Skip to content

Commit

Permalink
test error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
justin808 committed Mar 25, 2024
1 parent 7a67d1a commit e1aa3fc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .controlplane/controlplane.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ aliases:
# Production apps will use a different org than staging for security.
# Change this value to your org name
# or set ENV CPLN_ORG to your org name as that will override whatever is used here for all cpl commands
# cpln_org: shakacode-open-source-examples
cpln_org: shakacode-open-source-examples-staging

# Example apps use only location. CPLN offers the ability to use multiple locations.
default_location: aws-us-east-2
Expand Down
25 changes: 21 additions & 4 deletions .controlplane/release_script.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
#!/bin/bash -e

echo 'Running release_script.sh per controlplane.yml'

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

echo 'Completed release_script.sh per controlplane.yml'
error_exit() {
log "$1" 1>&2
exit 1
}

# Test error!
error_exit

log 'Running release_script.sh per controlplane.yml'

if [ -x ./bin/rails ]; then
log 'Run DB migrations'
./bin/rails db:prepare || error_exit "Failed to run DB migrations"
else
error_exit "./bin/rails does not exist or is not executable"
fi

log 'Completed release_script.sh per controlplane.yml'

0 comments on commit e1aa3fc

Please sign in to comment.