From 802226703abdfe256bad3ebbc59e01253e5c1a57 Mon Sep 17 00:00:00 2001 From: Shay Berman Date: Sun, 26 Aug 2018 17:55:12 +0300 Subject: [PATCH] add env MANIFEST_FLAG in helper_to_push_docker_manifest.sh + move scripts to ci dir --- .../{ => ci}/helper_to_push_docker_image.sh | 0 .../{ => ci}/helper_to_push_docker_manifest.sh | 18 ++++++++++-------- ...er_to_push_ubiquity_images_and_manifests.sh | 0 3 files changed, 10 insertions(+), 8 deletions(-) rename scripts/{ => ci}/helper_to_push_docker_image.sh (100%) rename scripts/{ => ci}/helper_to_push_docker_manifest.sh (75%) rename scripts/{ => ci}/helper_to_push_ubiquity_images_and_manifests.sh (100%) diff --git a/scripts/helper_to_push_docker_image.sh b/scripts/ci/helper_to_push_docker_image.sh similarity index 100% rename from scripts/helper_to_push_docker_image.sh rename to scripts/ci/helper_to_push_docker_image.sh diff --git a/scripts/helper_to_push_docker_manifest.sh b/scripts/ci/helper_to_push_docker_manifest.sh similarity index 75% rename from scripts/helper_to_push_docker_manifest.sh rename to scripts/ci/helper_to_push_docker_manifest.sh index f4f1d471..f609dfca 100755 --- a/scripts/helper_to_push_docker_manifest.sh +++ b/scripts/ci/helper_to_push_docker_manifest.sh @@ -9,6 +9,8 @@ # 2. The internal images should be exist in advance. # 3. The designated manifest should NOT be exist (the script will create it). # 4. "docker manifest" is enabled. +# 5. Optional: set environment MANIFEST_FLAG with dedicated flags for docker manifest commands. +# For example to push docker manifest for internal registry without certificates, one can use: export MANIFEST_FLAG="--insecure" # ---------------------------------------------------------------- function abort() @@ -52,28 +54,28 @@ echo "1. Make sure architecture images are not exist locally and if so remove th echo "2. Manifest validation \(manifest should not exit, not local nor remote\)..." ls -ld "$specific_manifest_dirname $specific_manifest_dirname_with_prefix" && abort 1 "local manifest dir should NOT exist before creating the manifest. Please clean it and rerun." if [ "$fail_if_exist" = "true" ]; then - docker manifest inspect $manifest && abort 1 "manifest inspect should NOT exist before pushing it. Please clean it and rerun." || : + docker manifest inspect $MANIFEST_FLAG $manifest && abort 1 "manifest inspect should NOT exist before pushing it. Please clean it and rerun." || : else - docker manifest inspect $manifest && echo "manifest inspect should NOT exist before pushing it. BUT fail_if_exist is not true so skip validation." || : + docker manifest inspect $MANIFEST_FLAG $manifest && echo "manifest inspect should NOT exist before pushing it. BUT fail_if_exist is not true so skip validation." || : fi echo "3. Manifest creation and push..." -docker manifest create $manifest ${image_amd64} ${image_ppc64le} ${image_s390x} || abort 2 "fail to create manifest." -docker manifest inspect $manifest || abort 2 "fail to inspect local manifest." -actual_manifest_arch_number=`docker manifest inspect $manifest | grep architecture | wc -l` +docker manifest create $MANIFEST_FLAG $manifest ${image_amd64} ${image_ppc64le} ${image_s390x} || abort 2 "fail to create manifest." +docker manifest inspect $MANIFEST_FLAG $manifest || abort 2 "fail to inspect local manifest." +actual_manifest_arch_number=`docker manifest inspect $MANIFEST_FLAG $manifest | grep architecture | wc -l` [ $actual_manifest_arch_number -ne $expected_manifest_arch_number ] && abort 3 "Manifest created but its not contain [$expected_manifest_arch_number] architectures as expected." -docker manifest push --purge $manifest || abort 2 "fail to push manifest to remote repo" +docker manifest push $MANIFEST_FLAG --purge $manifest || abort 2 "fail to push manifest to remote repo" ls -ld $specific_manifest_dirname $specific_manifest_dirname_with_prefix && abort 2 "Local manifest file should NOT exist after successful manifest push. Please check." || : echo "4. Remote manifest validation..." -docker manifest inspect $manifest || abort 3 "fail to inspect remote manifest." +docker manifest inspect $MANIFEST_FLAG $manifest || abort 3 "fail to inspect remote manifest." docker pull $manifest || abort 3 "fail pull remote manifest." expected_arch=`uname -m` docker run --rm $manifest uname -m | grep $expected_arch || abort 3 "The manifest run did not bring the expected arch" docker rmi $manifest # just remove the local manifest that was pulled for testing -actual_manifest_arch_number=`docker manifest inspect $manifest | grep architecture | wc -l` +actual_manifest_arch_number=`docker manifest inspect $MANIFEST_FLAG $manifest | grep architecture | wc -l` [ $actual_manifest_arch_number -ne $expected_manifest_arch_number ] && abort 3 "Manifest pushed but its not contain [$expected_manifest_arch_number] architectures as expected." diff --git a/scripts/helper_to_push_ubiquity_images_and_manifests.sh b/scripts/ci/helper_to_push_ubiquity_images_and_manifests.sh similarity index 100% rename from scripts/helper_to_push_ubiquity_images_and_manifests.sh rename to scripts/ci/helper_to_push_ubiquity_images_and_manifests.sh