-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GA v1.2.0 merge develop to master branch (#85)
GA v1.2.0
- Loading branch information
Showing
33 changed files
with
6,094 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright IBM Corporation 2020. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http:https://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM python:3 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN pip3 install operator-courier | ||
|
||
COPY . . | ||
CMD ["make", "courier"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
build/ci/multiarch/helper_to_push_csi_images_and_manifests.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/bin/bash -ex | ||
|
||
# ---------------------------------------------------------------- | ||
# This script is for internal use in CI | ||
# The script push all csi images from internal registry to external registry. | ||
# Images for amd64, ppc64le and s390x for each csi image : operator, controller and node. | ||
# It also creates and pushes relevant manifests per architecture into the external repository. | ||
# The script validates the whole process. If something gets wrong the script will fail with error. | ||
# Pre-requisites: | ||
# 1. Run docker login to the external registry in advance. | ||
# 2. The internal images should exist in advance. | ||
# 3. The external images should NOT exist (the script will create them). | ||
# 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 | ||
# ---------------------------------------------------------------- | ||
|
||
function push_arch_images_and_create_manifest_for_app() { | ||
# This function push <app> arch images(X, P and Z) from internal registry to external registry and then create manifest for them on the external registry. | ||
# Function arguments : | ||
# <app name> | ||
# <in_app_image_AMD64> <out_app_image_AMD64> | ||
# <in_app_image_PPC64LE> <out_app_image_PPC64LE> | ||
# <in_app_image_S390X> <out_app_image_S390X> | ||
# <out_app_image_MULTIARCH> | ||
# <tag_LATEST> | ||
|
||
app_name="$1" | ||
in_app_image_AMD64="$2" | ||
out_app_image_AMD64="$3" | ||
in_app_image_PPC64LE="$4" | ||
out_app_image_PPC64LE="$5" | ||
in_app_image_S390X="$6" | ||
out_app_image_S390X="$7" | ||
out_app_image_MULTIARCH="$8" | ||
tag_LATEST="$9" | ||
|
||
echo "" | ||
echo "Start to push $app_name images and manifest..." | ||
$HELPER_PUSH_IMAGE $in_app_image_AMD64 $out_app_image_AMD64 $tag_LATEST | ||
$HELPER_PUSH_IMAGE $in_app_image_PPC64LE $out_app_image_PPC64LE $tag_LATEST | ||
$HELPER_PUSH_IMAGE $in_app_image_S390X $out_app_image_S390X $tag_LATEST | ||
$HELPER_PUSH_MANIFEST $out_app_image_MULTIARCH $out_app_image_AMD64 $out_app_image_PPC64LE $out_app_image_S390X | ||
if [ -n "$tag_LATEST" ]; then | ||
latest_external_image=$(echo $out_app_image_MULTIARCH | sed "s|^\(.*/.*:\)\(.*\)$|\1$tag_LATEST|") # replace tag with $tag_LATEST | ||
$HELPER_PUSH_MANIFEST $latest_external_image $out_app_image_AMD64 $out_app_image_PPC64LE $out_app_image_S390X no | ||
fi | ||
} | ||
|
||
operator_envs="in_OPERATOR_IMAGE_AMD64 out_OPERATOR_IMAGE_AMD64 in_OPERATOR_IMAGE_PPC64LE out_OPERATOR_IMAGE_PPC64LE in_OPERATOR_IMAGE_S390X out_OPERATOR_IMAGE_S390X out_OPERATOR_IMAGE_MULTIARCH" | ||
controller_envs="in_CONTROLLER_IMAGE_AMD64 out_CONTROLLER_IMAGE_AMD64 in_CONTROLLER_IMAGE_PPC64LE out_CONTROLLER_IMAGE_PPC64LE in_CONTROLLER_IMAGE_S390X out_CONTROLLER_IMAGE_S390X out_CONTROLLER_IMAGE_MULTIARCH" | ||
node_envs="in_NODE_IMAGE_AMD64 out_NODE_IMAGE_AMD64 in_NODE_IMAGE_PPC64LE out_NODE_IMAGE_PPC64LE in_NODE_IMAGE_S390X out_NODE_IMAGE_S390X out_NODE_IMAGE_MULTIARCH" | ||
|
||
HELPER_PUSH_IMAGE=./helper_to_push_docker_image.sh | ||
HELPER_PUSH_MANIFEST=./helper_to_push_docker_manifest.sh | ||
|
||
date | ||
# Validations | ||
[ -f $HELPER_PUSH_IMAGE -a -f $HELPER_PUSH_MANIFEST ] && : || exit 1 | ||
for expected_env in $operator_envs $controller_envs $node_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)" | ||
done | ||
|
||
echo "TAG_LATEST=$TAG_LATEST" | ||
|
||
push_arch_images_and_create_manifest_for_app "operator" $in_OPERATOR_IMAGE_AMD64 $out_OPERATOR_IMAGE_AMD64 $in_OPERATOR_IMAGE_PPC64LE $out_OPERATOR_IMAGE_PPC64LE $in_OPERATOR_IMAGE_S390X $out_OPERATOR_IMAGE_S390X $out_OPERATOR_IMAGE_MULTIARCH $TAG_LATEST | ||
push_arch_images_and_create_manifest_for_app "controller" $in_CONTROLLER_IMAGE_AMD64 $out_CONTROLLER_IMAGE_AMD64 $in_CONTROLLER_IMAGE_PPC64LE $out_CONTROLLER_IMAGE_PPC64LE $in_CONTROLLER_IMAGE_S390X $out_CONTROLLER_IMAGE_S390X $out_CONTROLLER_IMAGE_MULTIARCH $TAG_LATEST | ||
push_arch_images_and_create_manifest_for_app "node" $in_NODE_IMAGE_AMD64 $out_NODE_IMAGE_AMD64 $in_NODE_IMAGE_PPC64LE $out_NODE_IMAGE_PPC64LE $in_NODE_IMAGE_S390X $out_NODE_IMAGE_S390X $out_NODE_IMAGE_MULTIARCH $TAG_LATEST | ||
|
||
date | ||
echo "######################################" | ||
echo "Finish to push successfully all images" | ||
echo "######################################" | ||
|
||
echo $out_OPERATOR_IMAGE_MULTIARCH | ||
echo $out_CONTROLLER_IMAGE_MULTIARCH | ||
echo $out_NODE_IMAGE_MULTIARCH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/bash -xe | ||
|
||
# This script is for internal use in CI | ||
# Assume docker login to the external registry was done in advance. | ||
|
||
function usage() | ||
{ | ||
echo $0 [internal-image-path] [external-image-path] [latest-tag-optional] | ||
exit 1 | ||
} | ||
|
||
[ $# -eq 2 -o $# -eq 3 ] || { usage; } | ||
|
||
internal_image=$1 | ||
external_image=$2 | ||
latest="$3" | ||
|
||
# if also latest, then define latest_external_image (replace the external tag with the $latest wanted tag) | ||
if [ -n "$latest" ]; then | ||
latest_external_image=`echo $external_image | sed "s|^\(.*/.*:\)\(.*\)$|\1$latest|"` | ||
latest_str_msg=" And latest tag image [$latest_external_image]" | ||
fi | ||
|
||
echo "Preparing to push internal_image --> external_image:" | ||
echo " internal_image=[$internal_image]" | ||
echo " external_image=[$external_image]" | ||
[ -n "$latest" ] && echo " latest_image =[$latest_external_image]" | ||
|
||
|
||
echo "1. Validate no external_image exists yet before pushing it." # Note: no need to test latest tag since it already exists | ||
docker pull $external_image && { echo "Error : the $external_image exists in remote. Cannot overwrite it."; exit 1; } || { echo "$external_image is not exist on the remote."; } | ||
echo "" | ||
|
||
|
||
echo "2. Validate internal_image does not exist yet on local." | ||
docker images $internal_image | ||
docker rmi $internal_image && { echo "Remove the internal_image image to pull it again"; } || { echo "internal_image does not exist on local. Continue."; } | ||
echo "" | ||
|
||
|
||
echo "3. Pull internal_image to local" | ||
docker pull $internal_image | ||
echo "" | ||
|
||
|
||
echo "4. Tag internal_image to external_image (and latest=[$latest_external_image]) and remove the internal_image" | ||
docker tag $internal_image $external_image | ||
[ -n "$latest_external_image" ] && docker tag $internal_image $latest_external_image | ||
docker rmi $internal_image | ||
docker push $external_image | ||
[ -n "$latest_external_image" ] && docker push $latest_external_image | ||
echo "" | ||
|
||
|
||
echo "5. Test pushed image by delete the local and pull it back" | ||
docker rmi $external_image | ||
docker pull $external_image | ||
docker rmi $external_image | ||
|
||
|
||
if [ -n "$latest_external_image" ]; then | ||
echo "6. Test pushed [latest] image by delete the local and pull it back" | ||
docker rmi $latest_external_image | ||
docker pull $latest_external_image | ||
docker rmi $latest_external_image | ||
fi | ||
|
||
set +x | ||
echo "" | ||
echo "Succeeded to push internal_image --> external_image" | ||
echo " internal_image=[$internal_image]" | ||
echo " external_image=[$external_image]" | ||
[ -n "$latest" ] && echo " latest_image =[$latest_external_image]" | ||
set -x | ||
|
Oops, something went wrong.