Heroku release command bash wrapper (#18743)
* Add tiny Bash wrapper to check for Node before attempting to execute Heroku release script * Use the wrapper script for the Heroku release command * Be explicit about exiting with Node's exit code * If Node is missing, exit using that script's exit code
This commit is contained in:
2
Procfile
2
Procfile
@@ -1,3 +1,3 @@
|
|||||||
web: NODE_ENV=production node server.js
|
web: NODE_ENV=production node server.js
|
||||||
|
|
||||||
release: NODE_ENV=production node script/purge-redis-pages.js
|
release: NODE_ENV=production script/release-heroku
|
||||||
|
|||||||
31
script/release-heroku
Executable file
31
script/release-heroku
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# [start-readme]
|
||||||
|
#
|
||||||
|
# Light Bash wrapper for the Heroku release command, which sometimes fails
|
||||||
|
# unexpectedly in staging environments when a Node installation is missing
|
||||||
|
#
|
||||||
|
# [end-readme]
|
||||||
|
|
||||||
|
# Check for node but don't fail immediately if it's not present
|
||||||
|
./script/check-for-node
|
||||||
|
EXIT_STATUS=$?
|
||||||
|
|
||||||
|
# If node is missing...
|
||||||
|
if [[ "$EXIT_STATUS" -ne "0" ]]; then
|
||||||
|
# Fail hard if this is our Heroku production app or if Redis is configured
|
||||||
|
if [[ "$HEROKU_PRODUCTION_APP" == "true" || -n "$REDIS_URL" ]]; then
|
||||||
|
echo "Error: cannot execute the release script without Node.js, which is fatal."
|
||||||
|
echo "Exiting..."
|
||||||
|
exit $EXIT_STATUS
|
||||||
|
# Otherwise succeed with only a warning
|
||||||
|
else
|
||||||
|
echo "Warning: although Node.js is missing, it is non-critical."
|
||||||
|
echo "Exiting..."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Execute the release script and exit with its status
|
||||||
|
node script/purge-redis-pages.js
|
||||||
|
exit $?
|
||||||
Reference in New Issue
Block a user