Let the build script abort in case of network issues
This commit is contained in:
parent
632739aec0
commit
224edc4642
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#set -x # Display the value of PS4, followed by the command and its arguments.
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
set -u # Treat unset variables as an error when substituting.
|
||||
|
||||
|
@ -28,12 +29,15 @@ purge_local () {
|
|||
# clone repo if not already there
|
||||
clone_local () {
|
||||
if [ ! -d "$CLONE_DIR" ]; then
|
||||
git clone \
|
||||
if ! git clone \
|
||||
--quiet \
|
||||
--branch "$BRANCH" \
|
||||
--recurse-submodules \
|
||||
"${GIT_BASE}/${OWNER}/${REPO}.git" \
|
||||
"$CLONE_DIR"
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -69,11 +73,14 @@ latest_local_sha () {
|
|||
|
||||
# get latest commit id of server
|
||||
latest_remote_sha () {
|
||||
curl -sq \
|
||||
if ! curl --silent --fail --show-error \
|
||||
-X GET \
|
||||
-H "accept: application/json" \
|
||||
"${GIT_BASE}/api/v1/repos/${OWNER}/${REPO}/commits?sha=${BRANCH}&limit=1" \
|
||||
| jq -M -r '.[0].sha'
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue