From 3c0b0c51bba72aa678212eef3873b76961f450d4 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 18 Jun 2020 12:58:57 -0500 Subject: [PATCH] fixing automation --- .automation/cleanup-docker.sh | 50 ++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/.automation/cleanup-docker.sh b/.automation/cleanup-docker.sh index 56f8128b..ab333098 100755 --- a/.automation/cleanup-docker.sh +++ b/.automation/cleanup-docker.sh @@ -61,6 +61,34 @@ ValidateInput() echo "Successfully found:[GITHUB_WORKSPACE], value:[$GITHUB_WORKSPACE]" fi + ####################### + # Validate IMAGE_REPO # + ####################### + if [ -z "$IMAGE_REPO" ]; then + # No repo was pulled + echo "ERROR! Failed to get [IMAGE_REPO]!" + echo "ERROR:[$IMAGE_REPO]" + exit 1 + elif [[ "$IMAGE_REPO" == "github/super-linter" ]]; then + # Found our main repo + echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]" + else + # This is a fork and we cant pull vars or any info + echo "WARN! No image to cleanup as this is a forked branch, and not being built with current automation!" + exit 0 + fi + + ########################## + # Validate IMAGE_VERSION # + ########################## + if [ -z "$IMAGE_VERSION" ]; then + echo "ERROR! Failed to get [IMAGE_VERSION]!" + echo "ERROR:[$IMAGE_VERSION]" + exit 1 + else + echo "Successfully found:[IMAGE_VERSION], value:[$IMAGE_VERSION]" + fi + ############################ # Validate DOCKER_USERNAME # ############################ @@ -83,28 +111,6 @@ ValidateInput() echo "Successfully found:[DOCKER_PASSWORD], value:[********]" fi - ####################### - # Validate IMAGE_REPO # - ####################### - if [ -z "$IMAGE_REPO" ]; then - echo "ERROR! Failed to get [IMAGE_REPO]!" - echo "ERROR:[$IMAGE_REPO]" - exit 1 - else - echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]" - fi - - ########################## - # Validate IMAGE_VERSION # - ########################## - if [ -z "$IMAGE_VERSION" ]; then - echo "ERROR! Failed to get [IMAGE_VERSION]!" - echo "ERROR:[$IMAGE_VERSION]" - exit 1 - else - echo "Successfully found:[IMAGE_VERSION], value:[$IMAGE_VERSION]" - fi - ################################################## # Check if we need to get the name of the branch # ##################################################