[CI] Fail job when CircleCI didn't set required vars

This commit is contained in:
JAremko 2020-06-23 19:11:09 +03:00 committed by Eugene Yaremenko
parent 5dcf7ae8e6
commit f81c644b68
7 changed files with 24 additions and 7 deletions

View File

@ -11,7 +11,8 @@
##
## License: GPLv3
skip_for_branch_update
skip_when_branch_update
fail_when_undefined_pr_number
pr_base=$(curl -s "${pr_data_URL}" | jq '.base.ref')
if [[ "${pr_base}" == "\"${dev_b}\"" ]]; then

View File

@ -11,13 +11,15 @@
##
## License: GPLv3
skip_for_branch_update
skip_when_branch_update
if [[ "$CIRCLE_PR_USERNAME" == "${bot_login}" ]]; then
echo "Fun fact. Bots can't climb stairs or update CHANGELOG.develop"
exit 0
fi
fail_when_undefined_pr_number
if grep -q CHANGELOG.develop /tmp/changed_files; then
echo "CHANGELOG.develop was updated as required"
else

View File

@ -11,7 +11,8 @@
##
## License: GPLv3
skip_for_branch_update
skip_when_branch_update
fail_when_undefined_pr_number
upstream_head_sha=$(curl -s "${upstream_data_URL}" | jq '.commit.sha')
pr_base_sha=$(curl -s "${pr_data_URL}" | jq '.base.sha')

View File

@ -11,7 +11,8 @@
##
## License: GPLv3
skip_for_branch_update
skip_when_branch_update
fail_when_undefined_pr_number
echo "PATCH_URL: \"${pr_patch_URL}\""

View File

@ -48,8 +48,18 @@ select_changed_orgs () {
done </tmp/changed_files
}
skip_for_branch_update () {
fail_when_undefined_pr_number () {
if [[ -z "${CIRCLE_PR_NUMBER// }" ]]; then
echo "CircleCI didn't set $CIRCLE_PR_NUMBER"
echo "nor $CIRCLE_PULL_REQUEST! This time..."
echo "Job restart sometimes helps."
echo "Aborting the job."
exit 1
fi
}
skip_when_branch_update () {
if [[ "${IS_BRANCH_UPDATE}" == "yes" ]]; then
echo "Skipping for branch update."
exit 0
fi

View File

@ -11,7 +11,8 @@
##
## License: GPLv3
skip_for_branch_update
skip_when_branch_update
fail_when_undefined_pr_number
select_changed_orgs
if [ ${#changed_f_as_args[@]} -ne 0 ]; then

View File

@ -11,7 +11,8 @@
##
## License: GPLv3
skip_for_branch_update
skip_when_branch_update
fail_when_undefined_pr_number
select_changed_orgs
if [ ${#changed_f_as_args[@]} -ne 0 ]; then