CI: check if necessary environment variables are set

This commit is contained in:
Leonid Pliushch 2019-07-22 20:03:32 +03:00
parent 25d5506e06
commit d7087a90b1
1 changed files with 12 additions and 0 deletions

View File

@ -32,6 +32,18 @@ fi
set +e
# Some environment variables are important for correct functionality
# of this script.
if [ -z "$CIRRUS_CHANGE_IN_REPO" ]; then
echo "[!] CIRRUS_CHANGE_IN_REPO is not set."
exit 1
fi
if [ -n "$CIRRUS_PR" ] && [ -z "${CIRRUS_BASE_SHA}" ]; then
echo "[!] CIRRUS_BASE_SHA is not set."
exit 1
fi
# Process tag '%ci:no-build' that may be added as line to commit message.
# Will force CI to exit with status 'passed' without performing build.
if grep -qiP '^\s*%ci:no-build\s*$' <(git log --format="%B" -n 1 "$CIRRUS_CHANGE_IN_REPO"); then