You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/01/08 07:21:56 UTC
[airflow] branch master updated: The check for image is now more
robust (#13556)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/master by this push:
new dc7d0a6 The check for image is now more robust (#13556)
dc7d0a6 is described below
commit dc7d0a674331674f5d692180d7b12f3fb048b26c
Author: Jarek Potiuk <ja...@polidea.com>
AuthorDate: Fri Jan 8 08:21:45 2021 +0100
The check for image is now more robust (#13556)
The request to get manifest of the image in GitHub Packages
might randomly return either schma 1 response:
{
"schemaVersion": 1,
"name": "apache/airflow/master-python3.6-ci",
"tag": "470317521",
"architecture": "amd64",
"fsLayers": [
{
Or schema 2 response:
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 56952,
"digest": "sha256:5c80e2ab289647802affafc5c1efc879fe4f5b559cb7a2a1215868e84b1d6424"
},
In order to check image more reliably we check the status code
of the curl response instead.
---
scripts/ci/images/ci_wait_for_ci_image.sh | 2 --
scripts/ci/images/ci_wait_for_prod_image.sh | 2 --
scripts/ci/libraries/_push_pull_remove_images.sh | 24 +++++-------------------
3 files changed, 5 insertions(+), 23 deletions(-)
diff --git a/scripts/ci/images/ci_wait_for_ci_image.sh b/scripts/ci/images/ci_wait_for_ci_image.sh
index e7de2cb..a3ebc78 100755
--- a/scripts/ci/images/ci_wait_for_ci_image.sh
+++ b/scripts/ci/images/ci_wait_for_ci_image.sh
@@ -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"
diff --git a/scripts/ci/images/ci_wait_for_prod_image.sh b/scripts/ci/images/ci_wait_for_prod_image.sh
index 0a2544e..c7a21ac 100755
--- a/scripts/ci/images/ci_wait_for_prod_image.sh
+++ b/scripts/ci/images/ci_wait_for_prod_image.sh
@@ -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}"
diff --git a/scripts/ci/libraries/_push_pull_remove_images.sh b/scripts/ci/libraries/_push_pull_remove_images.sh
index 0f88828..89fb949 100644
--- a/scripts/ci/libraries/_push_pull_remove_images.sh
+++ b/scripts/ci/libraries/_push_pull_remove_images.sh
@@ -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() {
@@ -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
-}