@@ -178,19 +178,18 @@ steps:
178178 # Periodically poll if the snyk-monitor has upgraded
179179 for (( attempt=1; attempt<ATTEMPTS; attempt++))
180180 do
181- # Grab the tag of the snyk-monitor container image. If snyk-monitor is not deployed for some reason, we exit immediately.
181+ # Grab the tag of the snyk-monitor container image
182+
182183 VERSION=$(kubectl get pods -n snyk-monitor --no-headers | \
183184 grep "snyk-monitor" | \
184- awk 'END { if (NR==0) exit 1 ; else print $1 }' | \
185+ awk 'END { if (NR==0) print "" ; else print $1 }' | \
185186 xargs '-I{}' kubectl get pod '{}' -n snyk-monitor -o 'jsonpath={..containers[*].image}' | \
186- awk '{print $1}' | grep -oE "[0-9]{1}\.[0-9]{1,2}\.[0-9]{1,3}$")
187-
188- if [[ -z "${VERSION}" ]]; then
189- VERSION="0.0.0"
190- fi
187+ awk '{print $1}' | \
188+ grep -oE "[0-9]{1}\.[0-9]{1,2}\.[0-9]{1,3}-ubi8$" \
189+ || echo "0.0.0")
191190
192191 # Break out of the polling if the tag matches the one we want to upgrade to.
193- if [[ "${VERSION}" == "${LATEST_TAG}" ]]; then
192+ if [[ "${VERSION}" == "${LATEST_TAG}-ubi8 " ]]; then
194193 break
195194 fi
196195
@@ -203,7 +202,7 @@ steps:
203202 awk 'END { if (NR==0) exit 101; else print $1 }')
204203
205204 # If we polled for 5 minutes and the snyk-monitor still hasn't upgraded, fail the current job.
206- if [[ "${VERSION}" != "${LATEST_TAG}" ]]; then
205+ if [[ "${VERSION}" != "${LATEST_TAG}-ubi8 " ]]; then
207206 &>2 echo "versions (${VERSION}) does not match expected (${LATEST_TAG})!"
208207
209208 kubectl describe pod ${SNYK_MONITOR_POD} -n snyk-monitor
0 commit comments