Skip to content

Commit 09fbd1b

Browse files
authored
Merge pull request #1063 from snyk/fix/operator-upgrades
Fix/operator upgrades
2 parents de043bc + 8e36749 commit 09fbd1b

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

.circleci/config.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -603,19 +603,18 @@ jobs:
603603
# Periodically poll if the snyk-monitor has upgraded
604604
for (( attempt=1; attempt<ATTEMPTS; attempt++))
605605
do
606-
# Grab the tag of the snyk-monitor container image. If snyk-monitor is not deployed for some reason, we exit immediately.
606+
# Grab the tag of the snyk-monitor container image
607+
607608
VERSION=$(kubectl get pods -n snyk-monitor --no-headers | \
608609
grep "snyk-monitor" | \
609-
awk 'END { if (NR==0) exit 1; else print $1 }' | \
610+
awk 'END { if (NR==0) print ""; else print $1 }' | \
610611
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}$")
612-
613-
if [[ -z "${VERSION}" ]]; then
614-
VERSION="0.0.0"
615-
fi
612+
awk '{print $1}' | \
613+
grep -oE "[0-9]{1}\.[0-9]{1,2}\.[0-9]{1,3}-ubi8$" \
614+
|| echo "0.0.0")
616615
617616
# Break out of the polling if the tag matches the one we want to upgrade to.
618-
if [[ "${VERSION}" == "${LATEST_TAG}" ]]; then
617+
if [[ "${VERSION}" == "${LATEST_TAG}-ubi8" ]]; then
619618
break
620619
fi
621620
@@ -628,7 +627,7 @@ jobs:
628627
awk 'END { if (NR==0) exit 101; else print $1 }')
629628
630629
# If we polled for 5 minutes and the snyk-monitor still hasn't upgraded, fail the current job.
631-
if [[ "${VERSION}" != "${LATEST_TAG}" ]]; then
630+
if [[ "${VERSION}" != "${LATEST_TAG}-ubi8" ]]; then
632631
&>2 echo "versions (${VERSION}) does not match expected (${LATEST_TAG})!"
633632
634633
kubectl describe pod ${SNYK_MONITOR_POD} -n snyk-monitor

.circleci/config/jobs/operator_upgrade_tests.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)