Skip to content

Commit 937fd47

Browse files
committed
chore: delete test Operator from Quay on finishing OpenShift tests
The versioning scheme for our test Operators is 0.0.1-<commit sha>. Quay orders releases alphabetically when deciding what is the latest Operator release, meaning that the commit SHA with the highest string value wins - in the current case it is a several weeks old release starting with the SHA f6162b... This means we have been testing the wrong release with every OpenShift test run. The Operator catalog does not give us an easy way to pin to a specific version of the Operator, it will always choose the latest. Hence as a workaround we can delete the Operator from Quay once we are done testing it.
1 parent 645d01c commit 937fd47

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.circleci/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ jobs:
250250
export KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG=snyk/kubernetes-monitor:${IMAGE_TAG}-${CIRCLE_SHA1} &&
251251
docker pull ${KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG} &&
252252
.circleci/do-exclusively --branch staging --job ${CIRCLE_JOB} npm run test:integration:openshift4
253+
- run:
254+
name: Delete Operator from Quay
255+
command: |
256+
./scripts/delete-operator-from-quay.sh
257+
when: always
253258
- run:
254259
name: Notify Slack on failure
255260
command: |
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /bin/bash
2+
3+
set -e
4+
5+
QUAY_TOKEN=$(curl -H "Content-Type: application/json" -XPOST https://quay.io/cnr/api/v1/users/login -d "{\"user\": {\"username\": \"${QUAY_USERNAME}\", \"password\": \"${QUAY_PASSWORD}\"}}" | jq -r .token)
6+
OPERATOR_VERSION="0.0.1-${CIRCLE_SHA1}"
7+
8+
STATUSCODE=$( curl --silent --output /dev/stderr --write-out "%{http_code}" -XDELETE -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: $QUAY_TOKEN" "https://quay.io/cnr/api/v1/packages/snyk-runtime/snyk-operator/${OPERATOR_VERSION}/helm" )
9+
10+
if test $STATUSCODE -ge 300; then
11+
echo "Unexpected status code $STATUSCODE"
12+
exit 1
13+
fi

0 commit comments

Comments
 (0)