From 8e98bd4f2c679c3aa8aaa0b5190b8c8e64a79cb7 Mon Sep 17 00:00:00 2001 From: Evan Williams Date: Fri, 28 Feb 2020 14:44:50 -0800 Subject: [PATCH] Remove silent failures, abort on failure at each step Uses 'set -e' in root, build, and deploy entrypoints to abort on failure at each step, and removed the '&&' chaining. Also Remove some of the stderr pipes to /dev/null for certain steps because seeing these errors is important for debugging. --- build/entrypoint.sh | 5 ++++- deploy/entrypoint.sh | 23 +++++++++++++---------- entrypoint.sh | 20 ++++++++++---------- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/build/entrypoint.sh b/build/entrypoint.sh index 167dc7e..c7387b7 100755 --- a/build/entrypoint.sh +++ b/build/entrypoint.sh @@ -1,6 +1,9 @@ #!/bin/sh + +set -e + echo '👍 ENTRYPOINT HAS STARTED—INSTALLING THE GEM BUNDLE' -bundle install > /dev/null 2>&1 +bundle install bundle list | grep "jekyll (" echo '👍 BUNDLE INSTALLED—BUILDING THE SITE' bundle exec jekyll build diff --git a/deploy/entrypoint.sh b/deploy/entrypoint.sh index 64422c4..ce18c8e 100755 --- a/deploy/entrypoint.sh +++ b/deploy/entrypoint.sh @@ -1,14 +1,17 @@ #!/bin/sh + +set -e + cd build -remote_repo="https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" && \ -remote_branch="gh-pages" && \ -git init && \ -git config user.name "${GITHUB_ACTOR}" && \ -git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \ -git add . && \ -echo -n 'Files to Commit:' && ls -l | wc -l && \ -git commit -m'action build' > /dev/null 2>&1 && \ -git push --force $remote_repo master:$remote_branch > /dev/null 2>&1 && \ -rm -fr .git && \ +remote_repo="https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" +remote_branch="gh-pages" +git init +git config user.name "${GITHUB_ACTOR}" +git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" +git add . +echo -n 'Files to Commit:' && ls -l | wc -l +git commit -m'action build' > /dev/null +git push --force $remote_repo master:$remote_branch > /dev/null +rm -fr .git cd ../ echo '👍 GREAT SUCCESS!' diff --git a/entrypoint.sh b/entrypoint.sh index c54b598..4dee8b3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,15 +9,15 @@ echo '👍 BUNDLE INSTALLED—BUILDING THE SITE' bundle exec jekyll build echo '👍 THE SITE IS BUILT—PUSHING IT BACK TO GITHUB-PAGES' cd build -remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" && \ -remote_branch="gh-pages" && \ -git init && \ -git config user.name "${GITHUB_ACTOR}" && \ -git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \ -git add . && \ -echo -n 'Files to Commit:' && ls -l | wc -l && \ -git commit -m'action build' > /dev/null 2>&1 && \ -git push --force $remote_repo master:$remote_branch > /dev/null 2>&1 && \ -rm -fr .git && \ +remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" +remote_branch="gh-pages" +git init +git config user.name "${GITHUB_ACTOR}" +git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" +git add . +echo -n 'Files to Commit:' && ls -l | wc -l +git commit -m'action build' > /dev/null +git push --force $remote_repo master:$remote_branch > /dev/null +rm -fr .git cd ../ echo '👍 GREAT SUCCESS!'