From 4671142e0651b5f33747d6bde65cba6f3cb8cbb5 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Mon, 29 Jun 2020 12:39:10 -0500 Subject: [PATCH] adding logic to deploy major tag versions as well Co-authored-by: Thomas Hughes Co-authored-by: John Wiebalk --- .automation/upload-docker.sh | 81 +++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 2 deletions(-) diff --git a/.automation/upload-docker.sh b/.automation/upload-docker.sh index fe1414d3..eefb5c50 100755 --- a/.automation/upload-docker.sh +++ b/.automation/upload-docker.sh @@ -26,6 +26,8 @@ REGISTRY="${REGISTRY}" # What registry to upload | or &1 + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ $ERROR_CODE -ne 0 ]; then + # ERROR + echo "ERROR! failed to [tag] Dockerfile!" + exit 1 + else + # SUCCESS + echo "Successfully tagged image!" + fi fi } ################################################################################ @@ -328,7 +378,7 @@ UploadImage() exit 1 else # SUCCESS - echo "Successfully Uploaded Docker image to $REGISTRY!" + echo "Successfully Uploaded Docker image:[$IMAGE_VERSION] to $REGISTRY!" fi ######################### @@ -371,6 +421,33 @@ UploadImage() echo "Size:[$SIZE]" echo "----------------------------------------------" fi + + ############################################################### + # Check if we need to upload the major tagged version as well # + ############################################################### + if [ $UPDATE_MAJOR_TAG -eq 1 ]; then + ############################################ + # Upload the docker image that was created # + ############################################ + docker push "$IMAGE_REPO:$MAJOR_TAG" 2>&1 + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ $ERROR_CODE -ne 0 ]; then + # ERROR + echo "ERROR! failed to [upload] MAJOR_TAG:[$MAJOR_TAG] Dockerfile!" + exit 1 + else + # SUCCESS + echo "Successfully Uploaded TAGOR_TAG:[$MAJOR_TAG] Docker image to $REGISTRY!" + fi + fi } ################################################################################ #### Function Footer ###########################################################