Skip to content

Commit

Permalink
Prints nicer message in case of git push errors (apache#11320)
Browse files Browse the repository at this point in the history
We started to get more often "unknown blob" kind of errors when
pushing the images to GitHub Registry. While this is clearly a
GitHub issue, it's frequency of occurence and unclear message
make it a good candidate to write additional message with
instructions to the users, especially that now they have
an easy way to get to that information via status checks and
links leading to the log file, when this problem happens during
image building process.

This way users will know that they should simply rebase or
amend/force-push their change to fix it.
  • Loading branch information
potiuk authored Oct 7, 2020
1 parent 47b05a8 commit e2655f6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions scripts/ci/libraries/_push_pull_remove_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,21 @@ function push_pull_remove_images::push_ci_images_to_github() {
PYTHON_TAG_SUFFIX="-${GITHUB_REGISTRY_PUSH_IMAGE_TAG}"
fi
docker tag "${PYTHON_BASE_IMAGE}" "${GITHUB_REGISTRY_PYTHON_BASE_IMAGE}${PYTHON_TAG_SUFFIX}"
set +e
docker push "${GITHUB_REGISTRY_PYTHON_BASE_IMAGE}${PYTHON_TAG_SUFFIX}"
local result=$?
set -e
if [[ ${result} != "0" ]]; then
>&2 echo
>&2 echo "There was an unexpected error when pushing images to the GitHub Registry"
>&2 echo
>&2 echo "If you see 'unknown blob' or similar kind of error it means that it was a transient error"
>&2 echo "And it will likely be gone next time"
>&2 echo
>&2 echo "Please rebase your change or 'git commit --amend; git push --force' and try again"
>&2 echo
exit "${result}"
fi
}


Expand Down Expand Up @@ -198,7 +212,22 @@ function push_pull_remove_images::push_prod_images_to_github () {
# Also push prod build image
AIRFLOW_PROD_BUILD_TAGGED_IMAGE="${GITHUB_REGISTRY_AIRFLOW_PROD_BUILD_IMAGE}:${GITHUB_REGISTRY_PUSH_IMAGE_TAG}"
docker tag "${AIRFLOW_PROD_BUILD_IMAGE}" "${AIRFLOW_PROD_BUILD_TAGGED_IMAGE}"
set +e
docker push "${AIRFLOW_PROD_BUILD_TAGGED_IMAGE}"
local result=$?
set -e
if [[ ${result} != "0" ]]; then
>&2 echo
>&2 echo "There was an unexpected error when pushing images to the GitHub Registry"
>&2 echo
>&2 echo "If you see 'unknown blob' or similar kind of error it means that it was a transient error"
>&2 echo "And it will likely be gone next time"
>&2 echo
>&2 echo "Please rebase your change or 'git commit --amend; git push --force' and try again"
>&2 echo
exit "${result}"
fi

}


Expand Down

0 comments on commit e2655f6

Please sign in to comment.