diff --git a/pipelines/docker/kabanero-utils/scripts/imageurl_imagename_lowercase.sh b/pipelines/docker/kabanero-utils/scripts/imageurl_imagename_lowercase.sh index 40cda30a..63f62959 100755 --- a/pipelines/docker/kabanero-utils/scripts/imageurl_imagename_lowercase.sh +++ b/pipelines/docker/kabanero-utils/scripts/imageurl_imagename_lowercase.sh @@ -62,34 +62,28 @@ WARNING="[WARNING]" ERROR="[ERROR]" if [[ ! -z "$docker_registry_url" ]]; then - docker_registry_url_trimmed_trailing_slash=${docker_registry_url%/} - NUM_SLASHES=$(awk -F"/" '{print NF-1}' <<< "${docker_registry_url_trimmed_trailing_slash}") + docker_registry_url=${docker_registry_url%/} + NUM_SLASHES=$(awk -F"/" '{print NF-1}' <<< "${docker_registry_url}") if [[ ("$NUM_SLASHES" -ge 2 ) && ( ! -z $docker_imagename ) && ($docker_imagename != "null")]]; then - echo "$ERROR The image registry url=$docker_registry_url has imagename in it, and it is also provided as in input parameter=$docker_imagename to the pipeline as parameter, pipeline cannot take imagename twice, you can specify it from your (pipeline resourse) or through combination of (webhook setup and trigger template)." - exit 1 - fi -fi - -if [[ -z "$docker_registry_url" ]]; then - echo "$ERROR Please specify the image registry url in your webhook setup or event mediator or your pipeline resource and try again. - [Hint] : The image registry url can be docker.io/ ex: image-registry.openshift-image-registry.svc:5000/kabanero" - exit 1 -else - if [[ ( -z "$docker_imagename") || ("$docker_imagename" == "null") ]]; then - #Trim the trailing forward slash('/') and then count no of forward slash. - if [[ $docker_registry_url == */ ]];then - docker_registry_url=${docker_registry_url%/} - fi - NUM_SLASHES=$(awk -F"/" '{print NF-1}' <<< "${docker_registry_url}") + echo "$WARNING The image registry url=$docker_registry_url has imagename in it, and it is also provided as in input parameter=$docker_imagename to the pipeline as parameter,pipeline will use the imagename from $docker_registry_url." + DOCKER_IMAGE_URL=$docker_registry_url + else + #Start of else + if [[ ( -z "$docker_imagename") || ("$docker_imagename" == "null") ]]; then + #Trim the trailing forward slash('/') and then count no of forward slash. + if [[ $docker_registry_url == */ ]];then + docker_registry_url=${docker_registry_url%/} + fi + NUM_SLASHES=$(awk -F"/" '{print NF-1}' <<< "${docker_registry_url}") - # This case is to handle jenkins pipeline scenario, where the user would specify the image name in the app-deploy.yaml - if [[ (-f /workspace/$gitsource/$app_deploy_filename) && ("$NUM_SLASHES" = 1) ]];then - cd /workspace/$gitsource - APPNAME=$(awk '/^ name:/ {print $2; exit}' $app_deploy_filename) - docker_imagename_lowercase=$(echo $APPNAME | tr '[:upper:]' '[:lower:]') - else - #Checking the migration case where imagename can be empty and if registry url has imagename. - #ex: image-registry.openshift-image-registry.svc:5000/kabanero/kab60-java-spring-boot2:e7a1448806240f0294035097c0203caa3f + # This case is to handle jenkins pipeline scenario, where the user would specify the image name in the app-deploy.yaml + if [[ (-f /workspace/$gitsource/$app_deploy_filename) && ("$NUM_SLASHES" = 1) ]];then + cd /workspace/$gitsource + APPNAME=$(awk '/^ name:/ {print $2; exit}' $app_deploy_filename) + docker_imagename_lowercase=$(echo $APPNAME | tr '[:upper:]' '[:lower:]') + else + #Checking the migration case where imagename can be empty and if registry url has imagename. + #ex: image-registry.openshift-image-registry.svc:5000/kabanero/kab60-java-spring-boot2:e7a1448806240f0294035097c0203caa3f if [ "$NUM_SLASHES" = 1 ]; then echo "$ERROR image registry url=$docker_registry_url does not have imagename and tagname values, you can specify it in your pipeline resource or through trigger template and try again." exit 1 @@ -108,24 +102,31 @@ else fi docker_registry_url=$(echo $docker_registry_url | rev | cut -d"/" -f2- | rev) fi + fi + + elif [[ ! -z "$docker_imagename" ]]; then + docker_imagename_lowercase=$(echo $docker_imagename | tr '[:upper:]' '[:lower:]') + fi + + #If it reaches here it means it has set the variable docker_imagename_lowercase correctly. + # If docker_registry_url value does not have trailing '/' add it before concatenating it with imagename + if [[ $docker_registry_url != */ ]];then + docker_registry_url=$docker_registry_url/ fi - elif [[ ! -z "$docker_imagename" ]]; then - docker_imagename_lowercase=$(echo $docker_imagename | tr '[:upper:]' '[:lower:]') - fi -fi - - -#If it reaches here it means it has set the variable docker_imagename_lowercase correctly. -# If docker_registry_url value does not have trailing '/' add it before concatenating it with imagename -if [[ $docker_registry_url != */ ]];then - docker_registry_url=$docker_registry_url/ -fi -#Concatenate docker_registry_url with the docker_imagename_lowercase and docker_imagetag(if exists) -if [[ (! -z "$docker_imagetag") && ("$docker_imagetag" != "null") ]]; then - DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase:$docker_imagetag + #Concatenate docker_registry_url with the docker_imagename_lowercase and docker_imagetag(if exists) + if [[ (! -z "$docker_imagetag") && ("$docker_imagetag" != "null") ]]; then + DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase:$docker_imagetag + else + DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase + fi + + #End of else + fi else - DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase + echo "$ERROR Incoming image registry url is empty , please specify the image registry url in your webhook setup or event mediator or your pipeline resource and try again. + [Hint] : The image registry url can be docker.io/ ex: image-registry.openshift-image-registry.svc:5000/kabanero" + exit 1 fi echo "$DOCKER_IMAGE_URL" \ No newline at end of file diff --git a/pipelines/experimental/gitops/build-push-promote-task.yaml b/pipelines/experimental/gitops/build-push-promote-task.yaml index e3ce33cc..63f4625f 100644 --- a/pipelines/experimental/gitops/build-push-promote-task.yaml +++ b/pipelines/experimental/gitops/build-push-promote-task.yaml @@ -38,7 +38,7 @@ spec: # Refer to https://kabanero.io/docs/ref/general/reference/semver-governance.html for policy details. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -54,7 +54,7 @@ spec: # This steps builds the source project using appsody build. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 imagePullPolicy: Always command: ["/bin/bash"] args: @@ -116,7 +116,7 @@ spec: # Refer to https://kabanero.io/docs/ref/general/reference/semver-governance.html for policy details. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -133,7 +133,7 @@ spec: # Push the image built in the build step to the specified image registry. Optionally sign the image. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c diff --git a/pipelines/experimental/gitops/deploy-gitops-task.yaml b/pipelines/experimental/gitops/deploy-gitops-task.yaml index 721ccd95..719b81b4 100644 --- a/pipelines/experimental/gitops/deploy-gitops-task.yaml +++ b/pipelines/experimental/gitops/deploy-gitops-task.yaml @@ -10,7 +10,7 @@ spec: type: git steps: - name: deploy - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 script: | #!/usr/bin/env sh diff --git a/pipelines/experimental/gitops/deployment-condition.yaml b/pipelines/experimental/gitops/deployment-condition.yaml index 94d36a7a..a12c5edd 100644 --- a/pipelines/experimental/gitops/deployment-condition.yaml +++ b/pipelines/experimental/gitops/deployment-condition.yaml @@ -12,7 +12,7 @@ spec: description: "The Git event ref" check: name: deployment-condition - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/sh"] args: - -ce diff --git a/pipelines/experimental/gitops/image-scan-condition.yaml b/pipelines/experimental/gitops/image-scan-condition.yaml index e0d72e5c..b791b799 100644 --- a/pipelines/experimental/gitops/image-scan-condition.yaml +++ b/pipelines/experimental/gitops/image-scan-condition.yaml @@ -12,7 +12,7 @@ spec: description: "The Git event ref" check: name: image-scan-condition - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/sh"] args: - -ce diff --git a/pipelines/experimental/gitops/image-scan-task.yaml b/pipelines/experimental/gitops/image-scan-task.yaml index 2cf78f2f..0a38ac58 100644 --- a/pipelines/experimental/gitops/image-scan-task.yaml +++ b/pipelines/experimental/gitops/image-scan-task.yaml @@ -37,7 +37,7 @@ spec: - name: mount-image securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 # Temporarily make copy of mounted image since the mounted image will be unmounted when the container for this task ends. # TODO: Determine another way to persist the mounted container image across containers command: ['/bin/bash'] @@ -103,47 +103,82 @@ spec: # For now we needed to remove the code, because we moved out the script from utilities task to 'kabanero-utils' image # and this image uses some other image. ######## + # Tracing prefixes + INFO="[INFO]" + WARNING="[WARNING]" + ERROR="[ERROR]" + docker_registry_url=$(inputs.resources.docker-image.url) docker_imagename=$(inputs.params.docker-imagename) docker_imagetag=$(inputs.params.docker-imagetag) app_deploy_filename="app-deploy.yaml" - if [[ -z "$docker_registry_url" ]]; then - echo "Error : The input parameter docker-image resource url to the script is empty, please provide it and try again(Possible value example: docker.io/, image-registry.openshift-image-registry.svc:5000/kabanero)" - exit 1 - else - if [[ -z "$docker_imagename" ]]; then - if [[ -f /workspace/$gitsource/$app_deploy_filename ]];then - cd /workspace/$gitsource - APPNAME=$(awk '/^ name:/ {print $2; exit}' $app_deploy_filename) - - docker_imagename_lowercase=$(echo $APPNAME | tr '[:upper:]' '[:lower:]') + if [[ ! -z "$docker_registry_url" ]]; then + docker_registry_url=${docker_registry_url%/} + NUM_SLASHES=$(awk -F"/" '{print NF-1}' <<< "${docker_registry_url}") + if [[ ("$NUM_SLASHES" -ge 2 ) && ( ! -z $docker_imagename ) && ($docker_imagename != "null")]]; then + echo "$WARNING The image registry url=$docker_registry_url has imagename in it, and it is also provided as in input parameter=$docker_imagename to the pipeline as parameter,pipeline will use the imagename from $docker_registry_url." + DOCKER_IMAGE_URL=$docker_registry_url + else + #Start of else + if [[ ( -z "$docker_imagename") || ("$docker_imagename" == "null") ]]; then + #Trim the trailing forward slash('/') and then count no of forward slash. + if [[ $docker_registry_url == */ ]];then + docker_registry_url=${docker_registry_url%/} + fi + NUM_SLASHES=$(awk -F"/" '{print NF-1}' <<< "${docker_registry_url}") + + # This case is to handle jenkins pipeline scenario, where the user would specify the image name in the app-deploy.yaml + if [[ (-f /workspace/$gitsource/$app_deploy_filename) && ("$NUM_SLASHES" = 1) ]];then + cd /workspace/$gitsource + APPNAME=$(awk '/^ name:/ {print $2; exit}' $app_deploy_filename) + docker_imagename_lowercase=$(echo $APPNAME | tr '[:upper:]' '[:lower:]') + else + #Checking the migration case where imagename can be empty and if registry url has imagename. + #ex: image-registry.openshift-image-registry.svc:5000/kabanero/kab60-java-spring-boot2:e7a1448806240f0294035097c0203caa3f + if [ "$NUM_SLASHES" = 1 ]; then + echo "$ERROR image registry url=$docker_registry_url does not have imagename and tagname values, you can specify it in your pipeline resource or through trigger template and try again." + exit 1 + elif [ "$NUM_SLASHES" = 2 ]; then + url_imagename_tagname_Part=$(echo $docker_registry_url | rev | cut -d"/" -f1 | rev) + if [[ ( ! -z $url_imagename_tagname_Part ) && ( $url_imagename_tagname_Part == *":"* ) ]]; then + imagename=$(cut -d ':' -f 1 <<< "$url_imagename_tagname_Part" ) + docker_imagename_lowercase=$(echo $imagename | tr '[:upper:]' '[:lower:]') + docker_imagetag=$(cut -d ':' -f 2- <<< "$url_imagename_tagname_Part" ) + elif [[ (! -z $url_imagename_tagname_Part) ]]; then + imagename=$url_imagename_tagname_Part + docker_imagename_lowercase=$(echo $imagename | tr '[:upper:]' '[:lower:]') + else + echo "$ERROR docker_registry_url=$docker_registry_url does not have the imagename and the param docker_imagename is not specified. Please provide docker_registry_url with imagename or provide correct values for incoming params docker_imagename=$docker_imagename and try again. " + exit 1 + fi + docker_registry_url=$(echo $docker_registry_url | rev | cut -d"/" -f2- | rev) + fi + fi + + elif [[ ! -z "$docker_imagename" ]]; then + docker_imagename_lowercase=$(echo $docker_imagename | tr '[:upper:]' '[:lower:]') + fi + + #If it reaches here it means it has set the variable docker_imagename_lowercase correctly. + # If docker_registry_url value does not have trailing '/' add it before concatenating it with imagename + if [[ $docker_registry_url != */ ]];then + docker_registry_url=$docker_registry_url/ + fi + + #Concatenate docker_registry_url with the docker_imagename_lowercase and docker_imagetag(if exists) + if [[ (! -z "$docker_imagetag") && ("$docker_imagetag" != "null") ]]; then + DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase:$docker_imagetag else - echo "Error : docker_imagename is empty and the $app_deploy_filename is not present in the github appsody project. - Either provide the value for the variable or make the $app_deploy_filename file available in the github appsody project - Case 1: If you are running a pipeline where you do not want the docker imagename to be coming from 'app-deploy.yaml' , - you would need to provide the imagename from the Trigger file. - (Hint: Check the pipeline trigger file passing the input parameter 'docker_imagename' to the pipelines) - Case 2: If your requirement is to pull the imagename from the 'app-deploy.yaml' file variable 'name' , - then you need to make sure that you have the file available in the appsody project in github whose url you have provided as git-source to the pipeline" - exit 1 + DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase fi - else - docker_imagename_lowercase=$(echo $docker_imagename | tr '[:upper:]' '[:lower:]') + + #End of else fi - fi - - #If it reaches here it means it has set the variable docker_imagename_lowercase correctly. - #Check if trailing '/' exists for docker registry url, it not add it. - if [[ $docker_registry_url != */ ]];then - docker_registry_url=$docker_registry_url/ - fi - - #Concatenate docker_registry_url with the docker_imagename_lowercase and docker_imagetag(if exists) - if [[ ! -z "$docker_imagetag" ]]; then - DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase:$docker_imagetag else - DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase + echo "$ERROR Incoming image registry url is empty , please specify the image registry url in your webhook setup or event mediator or your pipeline resource and try again. + [Hint] : The image registry url can be docker.io/ ex: image-registry.openshift-image-registry.svc:5000/kabanero" + exit 1 fi INPUTS_RESOURCE_DOCKER_IMAGE_URL_LOWERCASE=$DOCKER_IMAGE_URL ####### diff --git a/pipelines/incubator/build-deploy-task.yaml b/pipelines/incubator/build-deploy-task.yaml index 5f598259..dd819901 100644 --- a/pipelines/incubator/build-deploy-task.yaml +++ b/pipelines/incubator/build-deploy-task.yaml @@ -32,7 +32,7 @@ spec: # This steps builds the source project using appsody build. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -85,7 +85,7 @@ spec: # Push the image built in the build step to the specified image registry. Optionally sign the image. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -146,7 +146,7 @@ spec: - mountPath: /var/lib/containers name: varlibcontainers - name: deploy-image - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ['/bin/sh'] args: - -c diff --git a/pipelines/incubator/build-push-jk-task.yaml b/pipelines/incubator/build-push-jk-task.yaml index 490d9350..69849eb6 100644 --- a/pipelines/incubator/build-push-jk-task.yaml +++ b/pipelines/incubator/build-push-jk-task.yaml @@ -35,7 +35,7 @@ spec: # This steps builds the source project using appsody build. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -91,7 +91,7 @@ spec: # Push the image built in the build step to the specified image registry. Optionally sign the image. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c diff --git a/pipelines/incubator/build-push-task.yaml b/pipelines/incubator/build-push-task.yaml index 36442fda..f2ae0eba 100644 --- a/pipelines/incubator/build-push-task.yaml +++ b/pipelines/incubator/build-push-task.yaml @@ -36,7 +36,7 @@ spec: # Refer to https://kabanero.io/docs/ref/general/reference/semver-governance.html for policy details. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -53,7 +53,7 @@ spec: # This steps builds the source project using appsody build. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -114,7 +114,7 @@ spec: # Refer to https://kabanero.io/docs/ref/general/reference/semver-governance.html for policy details. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -131,7 +131,7 @@ spec: # Push the image built in the build step to the specified image registry. Optionally sign the image. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c diff --git a/pipelines/incubator/build-task.yaml b/pipelines/incubator/build-task.yaml index 8c129e4e..c78dccfa 100644 --- a/pipelines/incubator/build-task.yaml +++ b/pipelines/incubator/build-task.yaml @@ -27,7 +27,7 @@ spec: # This steps builds the source project using appsody build. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c diff --git a/pipelines/incubator/deploy-task.yaml b/pipelines/incubator/deploy-task.yaml index 9b9f7626..adb92bdd 100644 --- a/pipelines/incubator/deploy-task.yaml +++ b/pipelines/incubator/deploy-task.yaml @@ -25,7 +25,7 @@ spec: - name: enforce-stack-policy-pre-deploy securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -43,7 +43,7 @@ spec: - name: gitsource value: git-source - name: deploy-image - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ['/bin/sh'] args: - -c diff --git a/pipelines/incubator/deployment-condition.yaml b/pipelines/incubator/deployment-condition.yaml index 90935cb7..0bc62af0 100644 --- a/pipelines/incubator/deployment-condition.yaml +++ b/pipelines/incubator/deployment-condition.yaml @@ -13,7 +13,7 @@ spec: description: "The Git event ref" check: name: deployment-condition - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/sh"] args: - -ce diff --git a/pipelines/incubator/events/build-push-promote-task.yaml b/pipelines/incubator/events/build-push-promote-task.yaml index 0cf8a8ba..81b3ff8e 100644 --- a/pipelines/incubator/events/build-push-promote-task.yaml +++ b/pipelines/incubator/events/build-push-promote-task.yaml @@ -37,7 +37,7 @@ spec: # Refer to https://kabanero.io/docs/ref/general/reference/semver-governance.html for policy details. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -53,7 +53,7 @@ spec: # This steps builds the source project using appsody build. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 imagePullPolicy: Always command: ["/bin/bash"] args: @@ -118,7 +118,7 @@ spec: # Refer to https://kabanero.io/docs/ref/general/reference/semver-governance.html for policy details. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -135,7 +135,7 @@ spec: # Push the image built in the build step to the specified image registry. Optionally sign the image. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c diff --git a/pipelines/incubator/events/build-task.yaml b/pipelines/incubator/events/build-task.yaml index b1bb107c..5f7f77d3 100644 --- a/pipelines/incubator/events/build-task.yaml +++ b/pipelines/incubator/events/build-task.yaml @@ -25,7 +25,7 @@ spec: # Refer to https://kabanero.io/docs/ref/general/reference/semver-governance.html for policy details. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -41,7 +41,7 @@ spec: # This steps builds the source project using appsody build. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 imagePullPolicy: Always command: ["/bin/bash"] args: @@ -102,7 +102,7 @@ spec: # Refer to https://kabanero.io/docs/ref/general/reference/semver-governance.html for policy details. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c diff --git a/pipelines/incubator/events/deploy-kustomize-task.yaml b/pipelines/incubator/events/deploy-kustomize-task.yaml index 1e43ae13..9bf3714a 100644 --- a/pipelines/incubator/events/deploy-kustomize-task.yaml +++ b/pipelines/incubator/events/deploy-kustomize-task.yaml @@ -10,7 +10,7 @@ spec: type: git steps: - name: deploy - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 script: | #!/usr/bin/env sh diff --git a/pipelines/incubator/events/deploy-task.yaml b/pipelines/incubator/events/deploy-task.yaml index 3807df11..b60c764f 100644 --- a/pipelines/incubator/events/deploy-task.yaml +++ b/pipelines/incubator/events/deploy-task.yaml @@ -26,7 +26,7 @@ spec: - name: enforce-stack-policy-pre-deploy securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -43,7 +43,7 @@ spec: - name: gitsource value: git-source - name: deploy-image - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ['/bin/sh'] args: - -c diff --git a/pipelines/incubator/events/deployment-condition.yaml b/pipelines/incubator/events/deployment-condition.yaml index f3505e1f..addc4b98 100644 --- a/pipelines/incubator/events/deployment-condition.yaml +++ b/pipelines/incubator/events/deployment-condition.yaml @@ -15,7 +15,7 @@ spec: description: "Determine if there should be a local deploy" check: name: deployment-condition - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/sh"] args: - -ce diff --git a/pipelines/incubator/events/image-retag-task.yaml b/pipelines/incubator/events/image-retag-task.yaml index a0c67e5b..6dac9bb4 100644 --- a/pipelines/incubator/events/image-retag-task.yaml +++ b/pipelines/incubator/events/image-retag-task.yaml @@ -17,7 +17,7 @@ spec: # Pull down the source image from the registry. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -42,7 +42,7 @@ spec: # Tag the pulled image with the new tag. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -67,7 +67,7 @@ spec: # Push the newly tagged image to the registry. securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c diff --git a/pipelines/incubator/events/image-scan-task.yaml b/pipelines/incubator/events/image-scan-task.yaml index 1ba8c95a..df83de18 100644 --- a/pipelines/incubator/events/image-scan-task.yaml +++ b/pipelines/incubator/events/image-scan-task.yaml @@ -38,7 +38,7 @@ spec: - name: mount-image securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 # Temporarily make copy of mounted image since the mounted image will be unmounted when the container for this task ends. # TODO: Determine another way to persist the mounted container image across containers command: ['/bin/bash'] @@ -104,47 +104,82 @@ spec: # For now we needed to remove the code, because we moved out the script from utilities task to 'kabanero-utils' image # and this image uses some other image. ######## + # Tracing prefixes + INFO="[INFO]" + WARNING="[WARNING]" + ERROR="[ERROR]" + docker_registry_url=$(inputs.resources.docker-image.url) docker_imagename=$(inputs.params.docker-imagename) docker_imagetag=$(inputs.params.docker-imagetag) app_deploy_filename="app-deploy.yaml" - if [[ -z "$docker_registry_url" ]]; then - echo "Error : The input parameter docker-image resource url to the script is empty, please provide it and try again(Possible value example: docker.io/, image-registry.openshift-image-registry.svc:5000/kabanero)" - exit 1 - else - if [[ -z "$docker_imagename" ]]; then - if [[ -f /workspace/$gitsource/$app_deploy_filename ]];then - cd /workspace/$gitsource - APPNAME=$(awk '/^ name:/ {print $2; exit}' $app_deploy_filename) - - docker_imagename_lowercase=$(echo $APPNAME | tr '[:upper:]' '[:lower:]') + if [[ ! -z "$docker_registry_url" ]]; then + docker_registry_url=${docker_registry_url%/} + NUM_SLASHES=$(awk -F"/" '{print NF-1}' <<< "${docker_registry_url}") + if [[ ("$NUM_SLASHES" -ge 2 ) && ( ! -z $docker_imagename ) && ($docker_imagename != "null")]]; then + echo "$WARNING The image registry url=$docker_registry_url has imagename in it, and it is also provided as in input parameter=$docker_imagename to the pipeline as parameter,pipeline will use the imagename from $docker_registry_url." + DOCKER_IMAGE_URL=$docker_registry_url + else + #Start of else + if [[ ( -z "$docker_imagename") || ("$docker_imagename" == "null") ]]; then + #Trim the trailing forward slash('/') and then count no of forward slash. + if [[ $docker_registry_url == */ ]];then + docker_registry_url=${docker_registry_url%/} + fi + NUM_SLASHES=$(awk -F"/" '{print NF-1}' <<< "${docker_registry_url}") + + # This case is to handle jenkins pipeline scenario, where the user would specify the image name in the app-deploy.yaml + if [[ (-f /workspace/$gitsource/$app_deploy_filename) && ("$NUM_SLASHES" = 1) ]];then + cd /workspace/$gitsource + APPNAME=$(awk '/^ name:/ {print $2; exit}' $app_deploy_filename) + docker_imagename_lowercase=$(echo $APPNAME | tr '[:upper:]' '[:lower:]') + else + #Checking the migration case where imagename can be empty and if registry url has imagename. + #ex: image-registry.openshift-image-registry.svc:5000/kabanero/kab60-java-spring-boot2:e7a1448806240f0294035097c0203caa3f + if [ "$NUM_SLASHES" = 1 ]; then + echo "$ERROR image registry url=$docker_registry_url does not have imagename and tagname values, you can specify it in your pipeline resource or through trigger template and try again." + exit 1 + elif [ "$NUM_SLASHES" = 2 ]; then + url_imagename_tagname_Part=$(echo $docker_registry_url | rev | cut -d"/" -f1 | rev) + if [[ ( ! -z $url_imagename_tagname_Part ) && ( $url_imagename_tagname_Part == *":"* ) ]]; then + imagename=$(cut -d ':' -f 1 <<< "$url_imagename_tagname_Part" ) + docker_imagename_lowercase=$(echo $imagename | tr '[:upper:]' '[:lower:]') + docker_imagetag=$(cut -d ':' -f 2- <<< "$url_imagename_tagname_Part" ) + elif [[ (! -z $url_imagename_tagname_Part) ]]; then + imagename=$url_imagename_tagname_Part + docker_imagename_lowercase=$(echo $imagename | tr '[:upper:]' '[:lower:]') + else + echo "$ERROR docker_registry_url=$docker_registry_url does not have the imagename and the param docker_imagename is not specified. Please provide docker_registry_url with imagename or provide correct values for incoming params docker_imagename=$docker_imagename and try again. " + exit 1 + fi + docker_registry_url=$(echo $docker_registry_url | rev | cut -d"/" -f2- | rev) + fi + fi + + elif [[ ! -z "$docker_imagename" ]]; then + docker_imagename_lowercase=$(echo $docker_imagename | tr '[:upper:]' '[:lower:]') + fi + + #If it reaches here it means it has set the variable docker_imagename_lowercase correctly. + # If docker_registry_url value does not have trailing '/' add it before concatenating it with imagename + if [[ $docker_registry_url != */ ]];then + docker_registry_url=$docker_registry_url/ + fi + + #Concatenate docker_registry_url with the docker_imagename_lowercase and docker_imagetag(if exists) + if [[ (! -z "$docker_imagetag") && ("$docker_imagetag" != "null") ]]; then + DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase:$docker_imagetag else - echo "Error : docker_imagename is empty and the $app_deploy_filename is not present in the github appsody project. - Either provide the value for the variable or make the $app_deploy_filename file available in the github appsody project - Case 1: If you are running a pipeline where you do not want the docker imagename to be coming from 'app-deploy.yaml' , - you would need to provide the imagename from the Trigger file. - (Hint: Check the pipeline trigger file passing the input parameter 'docker_imagename' to the pipelines) - Case 2: If your requirement is to pull the imagename from the 'app-deploy.yaml' file variable 'name' , - then you need to make sure that you have the file available in the appsody project in github whose url you have provided as git-source to the pipeline" - exit 1 + DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase fi - else - docker_imagename_lowercase=$(echo $docker_imagename | tr '[:upper:]' '[:lower:]') + + #End of else fi - fi - - #If it reaches here it means it has set the variable docker_imagename_lowercase correctly. - #Check if trailing '/' exists for docker registry url, it not add it. - if [[ $docker_registry_url != */ ]];then - docker_registry_url=$docker_registry_url/ - fi - - #Concatenate docker_registry_url with the docker_imagename_lowercase and docker_imagetag(if exists) - if [[ ! -z "$docker_imagetag" ]]; then - DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase:$docker_imagetag else - DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase + echo "$ERROR Incoming image registry url is empty , please specify the image registry url in your webhook setup or event mediator or your pipeline resource and try again. + [Hint] : The image registry url can be docker.io/ ex: image-registry.openshift-image-registry.svc:5000/kabanero" + exit 1 fi INPUTS_RESOURCE_DOCKER_IMAGE_URL_LOWERCASE=$DOCKER_IMAGE_URL ####### diff --git a/pipelines/incubator/image-retag-task.yaml b/pipelines/incubator/image-retag-task.yaml index ab2e9bf6..ef7a1912 100644 --- a/pipelines/incubator/image-retag-task.yaml +++ b/pipelines/incubator/image-retag-task.yaml @@ -22,7 +22,7 @@ spec: - name: buildah-pull securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -45,7 +45,7 @@ spec: - name: buildah-tag securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c @@ -68,7 +68,7 @@ spec: - name: buildah-push securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c diff --git a/pipelines/incubator/image-scan-task.yaml b/pipelines/incubator/image-scan-task.yaml index 2e9f1b00..101cc6ac 100644 --- a/pipelines/incubator/image-scan-task.yaml +++ b/pipelines/incubator/image-scan-task.yaml @@ -38,7 +38,7 @@ spec: - name: mount-image securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 # Temporarily make copy of mounted image since the mounted image will be unmounted when the container for this task ends. # TODO: Determine another way to persist the mounted container image across containers command: ['/bin/bash'] @@ -104,47 +104,83 @@ spec: # For now we needed to remove the code, because we moved out the script from utilities task to 'kabanero-utils' image # and this image uses some other image. ######## + # Tracing prefixes + INFO="[INFO]" + WARNING="[WARNING]" + ERROR="[ERROR]" + docker_registry_url=$(inputs.resources.docker-image.url) docker_imagename=$(inputs.params.docker-imagename) docker_imagetag=$(inputs.params.docker-imagetag) app_deploy_filename="app-deploy.yaml" - if [[ -z "$docker_registry_url" ]]; then - echo "Error : The input parameter docker-image resource url to the script is empty, please provide it and try again(Possible value example: docker.io/, image-registry.openshift-image-registry.svc:5000/kabanero)" - exit 1 - else - if [[ -z "$docker_imagename" ]]; then - if [[ -f /workspace/$gitsource/$app_deploy_filename ]];then - cd /workspace/$gitsource - APPNAME=$(awk '/^ name:/ {print $2; exit}' $app_deploy_filename) - - docker_imagename_lowercase=$(echo $APPNAME | tr '[:upper:]' '[:lower:]') + + if [[ ! -z "$docker_registry_url" ]]; then + docker_registry_url=${docker_registry_url%/} + NUM_SLASHES=$(awk -F"/" '{print NF-1}' <<< "${docker_registry_url}") + if [[ ("$NUM_SLASHES" -ge 2 ) && ( ! -z $docker_imagename ) && ($docker_imagename != "null")]]; then + echo "$WARNING The image registry url=$docker_registry_url has imagename in it, and it is also provided as in input parameter=$docker_imagename to the pipeline as parameter,pipeline will use the imagename from $docker_registry_url." + DOCKER_IMAGE_URL=$docker_registry_url + else + #Start of else + if [[ ( -z "$docker_imagename") || ("$docker_imagename" == "null") ]]; then + #Trim the trailing forward slash('/') and then count no of forward slash. + if [[ $docker_registry_url == */ ]];then + docker_registry_url=${docker_registry_url%/} + fi + NUM_SLASHES=$(awk -F"/" '{print NF-1}' <<< "${docker_registry_url}") + + # This case is to handle jenkins pipeline scenario, where the user would specify the image name in the app-deploy.yaml + if [[ (-f /workspace/$gitsource/$app_deploy_filename) && ("$NUM_SLASHES" = 1) ]];then + cd /workspace/$gitsource + APPNAME=$(awk '/^ name:/ {print $2; exit}' $app_deploy_filename) + docker_imagename_lowercase=$(echo $APPNAME | tr '[:upper:]' '[:lower:]') + else + #Checking the migration case where imagename can be empty and if registry url has imagename. + #ex: image-registry.openshift-image-registry.svc:5000/kabanero/kab60-java-spring-boot2:e7a1448806240f0294035097c0203caa3f + if [ "$NUM_SLASHES" = 1 ]; then + echo "$ERROR image registry url=$docker_registry_url does not have imagename and tagname values, you can specify it in your pipeline resource or through trigger template and try again." + exit 1 + elif [ "$NUM_SLASHES" = 2 ]; then + url_imagename_tagname_Part=$(echo $docker_registry_url | rev | cut -d"/" -f1 | rev) + if [[ ( ! -z $url_imagename_tagname_Part ) && ( $url_imagename_tagname_Part == *":"* ) ]]; then + imagename=$(cut -d ':' -f 1 <<< "$url_imagename_tagname_Part" ) + docker_imagename_lowercase=$(echo $imagename | tr '[:upper:]' '[:lower:]') + docker_imagetag=$(cut -d ':' -f 2- <<< "$url_imagename_tagname_Part" ) + elif [[ (! -z $url_imagename_tagname_Part) ]]; then + imagename=$url_imagename_tagname_Part + docker_imagename_lowercase=$(echo $imagename | tr '[:upper:]' '[:lower:]') + else + echo "$ERROR docker_registry_url=$docker_registry_url does not have the imagename and the param docker_imagename is not specified. Please provide docker_registry_url with imagename or provide correct values for incoming params docker_imagename=$docker_imagename and try again. " + exit 1 + fi + docker_registry_url=$(echo $docker_registry_url | rev | cut -d"/" -f2- | rev) + fi + fi + + elif [[ ! -z "$docker_imagename" ]]; then + docker_imagename_lowercase=$(echo $docker_imagename | tr '[:upper:]' '[:lower:]') + fi + + #If it reaches here it means it has set the variable docker_imagename_lowercase correctly. + # If docker_registry_url value does not have trailing '/' add it before concatenating it with imagename + if [[ $docker_registry_url != */ ]];then + docker_registry_url=$docker_registry_url/ + fi + + #Concatenate docker_registry_url with the docker_imagename_lowercase and docker_imagetag(if exists) + if [[ (! -z "$docker_imagetag") && ("$docker_imagetag" != "null") ]]; then + DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase:$docker_imagetag else - echo "Error : docker_imagename is empty and the $app_deploy_filename is not present in the github appsody project. - Either provide the value for the variable or make the $app_deploy_filename file available in the github appsody project - Case 1: If you are running a pipeline where you do not want the docker imagename to be coming from 'app-deploy.yaml' , - you would need to provide the imagename from the Trigger file. - (Hint: Check the pipeline trigger file passing the input parameter 'docker_imagename' to the pipelines) - Case 2: If your requirement is to pull the imagename from the 'app-deploy.yaml' file variable 'name' , - then you need to make sure that you have the file available in the appsody project in github whose url you have provided as git-source to the pipeline" - exit 1 + DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase fi - else - docker_imagename_lowercase=$(echo $docker_imagename | tr '[:upper:]' '[:lower:]') + + #End of else fi - fi - - #If it reaches here it means it has set the variable docker_imagename_lowercase correctly. - #Check if trailing '/' exists for docker registry url, it not add it. - if [[ $docker_registry_url != */ ]];then - docker_registry_url=$docker_registry_url/ - fi - - #Concatenate docker_registry_url with the docker_imagename_lowercase and docker_imagetag(if exists) - if [[ ! -z "$docker_imagetag" ]]; then - DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase:$docker_imagetag else - DOCKER_IMAGE_URL=$docker_registry_url$docker_imagename_lowercase + echo "$ERROR Incoming image registry url is empty , please specify the image registry url in your webhook setup or event mediator or your pipeline resource and try again. + [Hint] : The image registry url can be docker.io/ ex: image-registry.openshift-image-registry.svc:5000/kabanero" + exit 1 fi INPUTS_RESOURCE_DOCKER_IMAGE_URL_LOWERCASE=$DOCKER_IMAGE_URL ####### diff --git a/pipelines/incubator/validate-active-stack-task.yaml b/pipelines/incubator/validate-active-stack-task.yaml index 59d93220..074345db 100644 --- a/pipelines/incubator/validate-active-stack-task.yaml +++ b/pipelines/incubator/validate-active-stack-task.yaml @@ -12,7 +12,7 @@ spec: - name: validate-stack-is-active securityContext: privileged: true - image: kabanero/kabanero-utils@sha256:835371285400bf247ef5ec834d22c72629d2f4b11c304db22dca8f12ecd710ce + image: kabanero/kabanero-utils@sha256:d2534cb30f618975bd5a9554920050b36d1bde5a882e8bacf100773847ec9ae8 command: ["/bin/bash"] args: - -c