Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Refactor helper scripts to push images (rename scripts and fix manife…
Browse files Browse the repository at this point in the history
…st call)
  • Loading branch information
shay-berman committed May 14, 2018
1 parent 7b6096c commit c97d2ae
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions scripts/helper_to_push_ubiquity_images_and_manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# 1. Run docker login to the external registry in advance.
# 2. The internal images should be exist in advance.
# 3. The external images should NOT be exist (the script will creates them).
# 4. Helper scripts should be accessible: ./helper_to_push_internal_images_2hub.sh and ./helper_to_push_manifest.sh
# 4. Helper scripts should be accessible: ./helper_to_push_docker_image.sh and ./helper_to_push_docker_manifest.sh
# 5. Scripts input comes from environment variables, see ubiquity_*_envs and optional TAG_LATEST
# ----------------------------------------------------------------

Expand All @@ -19,9 +19,12 @@ ubiquity_db_envs="in_UBIQUITY_DB_IMAGE_AMD64 out_UBIQUITY_DB_IMAGE_AMD64 in_UBIQ
ubiquity_provisioner_envs="in_UBIQUITY_K8S_PROVISIONER_IMAGE_AMD64 out_UBIQUITY_K8S_PROVISIONER_IMAGE_AMD64 in_UBIQUITY_K8S_PROVISIONER_IMAGE_PPC64LE out_UBIQUITY_K8S_PROVISIONER_IMAGE_PPC64LE out_UBIQUITY_K8S_PROVISIONER_IMAGE_MULTIARCH"
ubiquity_flex_envs="in_UBIQUITY_K8S_FLEX_IMAGE_AMD64 out_UBIQUITY_K8S_FLEX_IMAGE_AMD64 in_UBIQUITY_K8S_FLEX_IMAGE_PPC64LE out_UBIQUITY_K8S_FLEX_IMAGE_PPC64LE out_UBIQUITY_K8S_FLEX_IMAGE_MULTIARCH"

HELPER_PUSH_IMAGE=./helper_to_push_docker_image.sh
HELPER_PUSH_MANIFEST=./helper_to_push_docker_manifest.sh

date
# Validations
[ -f ./helper_to_push_internal_images_2hub.sh -a -f ./helper_to_push_manifest.sh ] && : || exit 1
[ -f $HELPER_PUSH_IMAGE -a -f $HELPER_PUSH_MANIFEST ] && : || exit 1
for expected_env in $ubiquity_envs $ubiquity_db_envs $ubiquity_provisioner_envs $ubiquity_flex_envs; do
[ -z "`printenv $expected_env`" ] && { echo "Error: expected env [$expected_env] does not exist. Please set it first."; exit 1; } || :
echo "$expected_env=`printenv $expected_env`"
Expand All @@ -31,44 +34,44 @@ echo "TAG_LATEST=$TAG_LATEST"

echo ""
echo "Start to push Ubiquity images and manifests..."
./helper_to_push_internal_images_2hub.sh $in_UBIQUITY_IMAGE_AMD64 $out_UBIQUITY_IMAGE_AMD64 $TAG_LATEST
./helper_to_push_internal_images_2hub.sh $in_UBIQUITY_IMAGE_PPC64LE $out_UBIQUITY_IMAGE_PPC64LE $TAG_LATEST
./helper_to_push_manifest.sh $out_UBIQUITY_IMAGE_MULTIARCH $out_UBIQUITY_IMAGE_AMD64 $out_UBIQUITY_IMAGE_PPC64LE
$HELPER_PUSH_IMAGE $in_UBIQUITY_IMAGE_AMD64 $out_UBIQUITY_IMAGE_AMD64 $TAG_LATEST
$HELPER_PUSH_IMAGE $in_UBIQUITY_IMAGE_PPC64LE $out_UBIQUITY_IMAGE_PPC64LE $TAG_LATEST
$HELPER_PUSH_MANIFEST $out_UBIQUITY_IMAGE_MULTIARCH $out_UBIQUITY_IMAGE_AMD64 $out_UBIQUITY_IMAGE_PPC64LE
if [ -n "$TAG_LATEST" ]; then
latest_external_image=`echo $out_UBIQUITY_IMAGE_MULTIARCH | sed "s|^\(.*/.*:\)\(.*\)$|\1$TAG_LATEST|"` # replace tag with $TAG_LATEST
./helper_to_push_manifest.sh $latest_external_image $out_UBIQUITY_IMAGE_AMD64 $out_UBIQUITY_IMAGE_PPC64LE
$HELPER_PUSH_MANIFEST $latest_external_image $out_UBIQUITY_IMAGE_AMD64 $out_UBIQUITY_IMAGE_PPC64LE no
fi

echo ""
echo "Start to push Ubiquity DB images and manifests..."
./helper_to_push_internal_images_2hub.sh $in_UBIQUITY_DB_IMAGE_AMD64 $out_UBIQUITY_DB_IMAGE_AMD64 $TAG_LATEST
./helper_to_push_internal_images_2hub.sh $in_UBIQUITY_DB_IMAGE_PPC64LE $out_UBIQUITY_DB_IMAGE_PPC64LE $TAG_LATEST
./helper_to_push_manifest.sh $out_UBIQUITY_DB_IMAGE_MULTIARCH $out_UBIQUITY_DB_IMAGE_AMD64 $out_UBIQUITY_DB_IMAGE_PPC64LE $TAG_LATEST
$HELPER_PUSH_IMAGE $in_UBIQUITY_DB_IMAGE_AMD64 $out_UBIQUITY_DB_IMAGE_AMD64 $TAG_LATEST
$HELPER_PUSH_IMAGE $in_UBIQUITY_DB_IMAGE_PPC64LE $out_UBIQUITY_DB_IMAGE_PPC64LE $TAG_LATEST
$HELPER_PUSH_MANIFEST $out_UBIQUITY_DB_IMAGE_MULTIARCH $out_UBIQUITY_DB_IMAGE_AMD64 $out_UBIQUITY_DB_IMAGE_PPC64LE $TAG_LATEST
if [ -n "$TAG_LATEST" ]; then
latest_external_image=`echo $out_UBIQUITY_DB_IMAGE_MULTIARCH | sed "s|^\(.*/.*:\)\(.*\)$|\1$TAG_LATEST|"` # replace tag with $TAG_LATEST
./helper_to_push_manifest.sh $latest_external_image $out_UBIQUITY_DB_IMAGE_AMD64 $out_UBIQUITY_DB_IMAGE_PPC64LE $TAG_LATEST
$HELPER_PUSH_MANIFEST $latest_external_image $out_UBIQUITY_DB_IMAGE_AMD64 $out_UBIQUITY_DB_IMAGE_PPC64LE no
fi


echo ""
echo "Start to push Ubiquity provisioner images and manifests..."
./helper_to_push_internal_images_2hub.sh $in_UBIQUITY_K8S_PROVISIONER_IMAGE_AMD64 $out_UBIQUITY_K8S_PROVISIONER_IMAGE_AMD64 $TAG_LATEST
./helper_to_push_internal_images_2hub.sh $in_UBIQUITY_K8S_PROVISIONER_IMAGE_PPC64LE $out_UBIQUITY_K8S_PROVISIONER_IMAGE_PPC64LE $TAG_LATEST
./helper_to_push_manifest.sh $out_UBIQUITY_K8S_PROVISIONER_IMAGE_MULTIARCH $out_UBIQUITY_K8S_PROVISIONER_IMAGE_AMD64 $out_UBIQUITY_K8S_PROVISIONER_IMAGE_PPC64LE $TAG_LATEST
$HELPER_PUSH_IMAGE $in_UBIQUITY_K8S_PROVISIONER_IMAGE_AMD64 $out_UBIQUITY_K8S_PROVISIONER_IMAGE_AMD64 $TAG_LATEST
$HELPER_PUSH_IMAGE $in_UBIQUITY_K8S_PROVISIONER_IMAGE_PPC64LE $out_UBIQUITY_K8S_PROVISIONER_IMAGE_PPC64LE $TAG_LATEST
$HELPER_PUSH_MANIFEST $out_UBIQUITY_K8S_PROVISIONER_IMAGE_MULTIARCH $out_UBIQUITY_K8S_PROVISIONER_IMAGE_AMD64 $out_UBIQUITY_K8S_PROVISIONER_IMAGE_PPC64LE $TAG_LATEST
if [ -n "$TAG_LATEST" ]; then
latest_external_image=`echo $out_UBIQUITY_K8S_PROVISIONER_IMAGE_MULTIARCH | sed "s|^\(.*/.*:\)\(.*\)$|\1$TAG_LATEST|"` # replace tag with $TAG_LATEST
./helper_to_push_manifest.sh $latest_external_image $out_UBIQUITY_K8S_PROVISIONER_IMAGE_AMD64 $out_UBIQUITY_K8S_PROVISIONER_IMAGE_PPC64LE $TAG_LATEST
$HELPER_PUSH_MANIFEST $latest_external_image $out_UBIQUITY_K8S_PROVISIONER_IMAGE_AMD64 $out_UBIQUITY_K8S_PROVISIONER_IMAGE_PPC64LE no
fi


echo ""
echo "Start to push Ubiquity flex images and manifests..."
./helper_to_push_internal_images_2hub.sh $in_UBIQUITY_K8S_FLEX_IMAGE_AMD64 $out_UBIQUITY_K8S_FLEX_IMAGE_AMD64 $TAG_LATEST
./helper_to_push_internal_images_2hub.sh $in_UBIQUITY_K8S_FLEX_IMAGE_PPC64LE $out_UBIQUITY_K8S_FLEX_IMAGE_PPC64LE $TAG_LATEST
./helper_to_push_manifest.sh $out_UBIQUITY_K8S_FLEX_IMAGE_MULTIARCH $out_UBIQUITY_K8S_FLEX_IMAGE_AMD64 $out_UBIQUITY_K8S_FLEX_IMAGE_PPC64LE $TAG_LATEST
$HELPER_PUSH_IMAGE $in_UBIQUITY_K8S_FLEX_IMAGE_AMD64 $out_UBIQUITY_K8S_FLEX_IMAGE_AMD64 $TAG_LATEST
$HELPER_PUSH_IMAGE $in_UBIQUITY_K8S_FLEX_IMAGE_PPC64LE $out_UBIQUITY_K8S_FLEX_IMAGE_PPC64LE $TAG_LATEST
$HELPER_PUSH_MANIFEST $out_UBIQUITY_K8S_FLEX_IMAGE_MULTIARCH $out_UBIQUITY_K8S_FLEX_IMAGE_AMD64 $out_UBIQUITY_K8S_FLEX_IMAGE_PPC64LE $TAG_LATEST
if [ -n "$TAG_LATEST" ]; then
latest_external_image=`echo $out_UBIQUITY_K8S_FLEX_IMAGE_MULTIARCH | sed "s|^\(.*/.*:\)\(.*\)$|\1$TAG_LATEST|"` # replace tag with $TAG_LATEST
./helper_to_push_manifest.sh $latest_external_image $out_UBIQUITY_K8S_FLEX_IMAGE_AMD64 $out_UBIQUITY_K8S_FLEX_IMAGE_PPC64LE $TAG_LATEST
$HELPER_PUSH_MANIFEST $latest_external_image $out_UBIQUITY_K8S_FLEX_IMAGE_AMD64 $out_UBIQUITY_K8S_FLEX_IMAGE_PPC64LE no
fi


Expand Down

0 comments on commit c97d2ae

Please sign in to comment.