@@ -513,7 +513,7 @@ jobs:
513513
514514 # Package Operator Bundle to be uploaded to Docker Hub
515515 SNYK_OPERATOR_IMAGE_TAG=${OPERATOR_VERSION}
516- SNYK_MONITOR_IMAGE_TAG=${OPERATOR_VERSION}
516+ SNYK_MONITOR_IMAGE_TAG=${OPERATOR_VERSION}-ubi8
517517 OPERATOR_DIR=$(python scripts/operator/package_operator_bundle.py $OPERATOR_VERSION $SNYK_OPERATOR_IMAGE_TAG $SNYK_MONITOR_IMAGE_TAG)
518518
519519 python scripts/operator/create_operator_bundle_and_index_and_push.py $OPERATOR_DIR $OPERATOR_VERSION $DOCKERHUB_USER $DOCKERHUB_PASSWORD
@@ -582,8 +582,8 @@ jobs:
582582 set -eo pipefail
583583
584584 REPLACES_VERSION=${OPERATOR_VERSION}
585-
586- OPERATOR_DIR=$(python scripts/operator/package_operator_bundle.py "${LATEST_TAG}" "${LATEST_TAG}" "${LATEST_TAG }" "${REPLACES_VERSION}")
585+ SNYK_MONITOR_TAG=${LATEST_TAG}-ubi8
586+ OPERATOR_DIR=$(python scripts/operator/package_operator_bundle.py "${LATEST_TAG}" "${LATEST_TAG}" "${SNYK_MONITOR_TAG }" "${REPLACES_VERSION}")
587587 python scripts/operator/create_operator_bundle_and_index_and_push.py $OPERATOR_DIR $LATEST_TAG $DOCKERHUB_USER $DOCKERHUB_PASSWORD $REPLACES_VERSION
588588 description : Now we are testing that any upgrades to the Operator are detected and applied in the cluster.
589589 name : Package Operator Bundle upgrade and push to Docker Hub
@@ -600,18 +600,21 @@ jobs:
600600 SLEEP_SECONDS_BETWEEN_ATTEMPTS=5
601601 # total = 10 minutes wait time
602602
603+ EXPECTED_TAG="${LATEST_TAG}-ubi8"
603604 # Periodically poll if the snyk-monitor has upgraded
604605 for (( attempt=1; attempt<ATTEMPTS; attempt++))
605606 do
606- # Grab the tag of the snyk-monitor container image. If snyk-monitor is not deployed for some reason, we exit immediately.
607- VERSION=$(kubectl get pods -n snyk-monitor --no-headers | \
608- grep "snyk-monitor" | \
609- awk 'END { if (NR==0) exit 1; else print $1 }' | \
610- xargs -I{} kubectl get pod {} -n snyk-monitor -o jsonpath={..containers[*].image} | \
611- awk '{print $1}' | grep -oE "[0-9]{1}\.[0-9]{1,2}\.[0-9]{1,3}$")
607+ # Grab the tag of the snyk-monitor container image.
608+ SNYK_MONITOR_POD=$(kubectl get pods -n snyk-monitor --no-headers | grep "snyk-monitor")
609+ if [[ ! -z "${SNYK_MONITOR_POD}" ]]; then
610+ VERSION=$(echo "${SNYK_MONITOR_POD}" | \
611+ awk 'END { print $1 }' | \
612+ xargs '-I{}' kubectl get pod '{}' -n snyk-monitor -o 'jsonpath={..containers[*].image}' | \
613+ grep -oE "[0-9]{1}\.[0-9]{1,2}\.[0-9]{1,3}$")
614+ fi
612615
613616 # Break out of the polling if the tag matches the one we want to upgrade to.
614- if [[ "${VERSION}" == "${LATEST_TAG }" ]]; then
617+ if [[ "${VERSION}" == "${EXPECTED_TAG }" ]]; then
615618 break
616619 fi
617620
@@ -621,17 +624,17 @@ jobs:
621624
622625 SNYK_MONITOR_POD=$(kubectl get pods -n snyk-monitor --no-headers | \
623626 grep "snyk-monitor" | \
624- awk 'END { if (NR==0) exit 1 ; else print $1 }')
627+ awk 'END { if (NR==0) exit 101 ; else print $1 }')
625628
626629 # If we polled for 5 minutes and the snyk-monitor still hasn't upgraded, fail the current job.
627- if [[ "${VERSION}" != "${LATEST_TAG }" ]]; then
628- &>2 echo "versions (${VERSION}) does not match expected (${LATEST_TAG })!"
630+ if [[ "${VERSION}" != "${EXPECTED_TAG }" ]]; then
631+ &>2 echo "versions (${VERSION}) does not match expected (${EXPECTED_TAG })!"
629632
630633 kubectl describe pod ${SNYK_MONITOR_POD} -n snyk-monitor
631634 kubectl describe catalogsource snyk-operator -n openshift-marketplace
632635 kubectl get snykmonitors.charts.helm.k8s.io -n snyk-monitor -o yaml
633636
634- exit 1
637+ exit 102
635638 fi
636639
637640 # We need to wait for the Pod to become Ready
@@ -787,7 +790,8 @@ jobs:
787790 name : End tests early if no new Operator is to be released
788791 - run :
789792 command : |
790- OPERATOR_PATH=$(python scripts/operator/package_operator_bundle.py "${NEW_OPERATOR_VERSION}" "${NEW_OPERATOR_VERSION}" "${NEW_OPERATOR_VERSION}" "${LAST_OPERATOR_VERSION}")
793+ SNYK_MONITOR_TAG="${NEW_OPERATOR_VERSION}-ubi8"
794+ OPERATOR_PATH=$(python scripts/operator/package_operator_bundle.py "${NEW_OPERATOR_VERSION}" "${NEW_OPERATOR_VERSION}" "${SNYK_MONITOR_TAG}" "${LAST_OPERATOR_VERSION}")
791795 echo "export OPERATOR_PATH=${OPERATOR_PATH}" >> $BASH_ENV
792796 name : Package Operator Bundle
793797 - run :
@@ -853,7 +857,8 @@ jobs:
853857 name : End tests early if no new Operator is to be released
854858 - run :
855859 command : |
856- OPERATOR_PATH=$(python scripts/operator/package_operator_bundle.py "${NEW_OPERATOR_VERSION}" "${NEW_OPERATOR_VERSION}" "${NEW_OPERATOR_VERSION}" "${LAST_OPERATOR_VERSION}")
860+ SNYK_MONITOR_TAG="${NEW_OPERATOR_VERSION}-ubi8"
861+ OPERATOR_PATH=$(python scripts/operator/package_operator_bundle.py "${NEW_OPERATOR_VERSION}" "${NEW_OPERATOR_VERSION}" "${SNYK_MONITOR_TAG}" "${LAST_OPERATOR_VERSION}")
857862 echo "export OPERATOR_PATH=${OPERATOR_PATH}" >> $BASH_ENV
858863 name : Package Operator Bundle
859864 - run :
0 commit comments