Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The check for image is now more robust #13556

Merged
merged 1 commit into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions scripts/ci/images/ci_wait_for_ci_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

push_pull_remove_images::check_if_github_registry_wait_for_image_enabled

push_pull_remove_images::check_if_jq_installed

build_image::login_to_github_registry_if_needed

export AIRFLOW_CI_IMAGE_NAME="${BRANCH_NAME}-python${PYTHON_MAJOR_MINOR_VERSION}-ci"
Expand Down
2 changes: 0 additions & 2 deletions scripts/ci/images/ci_wait_for_prod_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

push_pull_remove_images::check_if_github_registry_wait_for_image_enabled

push_pull_remove_images::check_if_jq_installed

build_image::login_to_github_registry_if_needed

export AIRFLOW_PROD_IMAGE_NAME="${BRANCH_NAME}-python${PYTHON_MAJOR_MINOR_VERSION}"
Expand Down
24 changes: 5 additions & 19 deletions scripts/ci/libraries/_push_pull_remove_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -279,21 +279,19 @@ function push_pull_remove_images::wait_for_github_registry_image() {

GITHUB_API_CALL="${github_api_endpoint}/${image_name_in_github_registry}/manifests/${image_tag_in_github_registry}"
while true; do
curl --connect-timeout 60 --max-time 60 \
-X GET "${GITHUB_API_CALL}" -u "${GITHUB_USERNAME}:${GITHUB_TOKEN}" 2>/dev/null > "${OUTPUT_LOG}"
local digest
digest=$(jq '.config.digest' < "${OUTPUT_LOG}")
if [[ ${digest} != "null" ]]; then
http_status=$(curl --silent --output "${OUTPUT_LOG}" --write-out "%{http_code}" \
--connect-timeout 60 --max-time 60 \
-X GET "${GITHUB_API_CALL}" -u "${GITHUB_USERNAME}:${GITHUB_TOKEN}")
if [[ ${http_status} == "200" ]]; then
echo "${COLOR_GREEN_OK} ${COLOR_RESET}"
break
else
echo "${COLOR_YELLOW}Still waiting!${COLOR_RESET}"
echo "${COLOR_YELLOW}Still waiting - status code ${http_status}!${COLOR_RESET}"
cat "${OUTPUT_LOG}"
fi
sleep 60
done
verbosity::print_info "Found ${image_name_in_github_registry}:${image_tag_in_github_registry} image"
verbosity::print_info "Digest: '${digest}'"
}

function push_pull_remove_images::check_if_github_registry_wait_for_image_enabled() {
Expand All @@ -308,15 +306,3 @@ function push_pull_remove_images::check_if_github_registry_wait_for_image_enable
exit 1
fi
}

function push_pull_remove_images::check_if_jq_installed() {
start_end::group_start "JQ check"
echo
echo "Check if jq is installed"
echo
command -v jq >/dev/null || (echo "ERROR! You must have 'jq' tool installed!" && exit 1)
echo
echo "The jq version $(jq --version)"
echo
start_end::group_end
}