Skip to content

Commit 6397628

Browse files
authored
Merge pull request #1038 from snyk/feat/alpine-base-image
chore: trim Operator name in tests so it's within K8s name limits
2 parents 2d91a52 + f066d61 commit 6397628

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

.circleci/config.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ jobs:
7373
- run:
7474
command: |
7575
export IMAGE_TAG=$([[ "$CIRCLE_BRANCH" == "staging" ]] && echo "staging-candidate" || echo "discardable")
76-
OPERATOR_TAG="${IMAGE_TAG}-ubi8-${CIRCLE_SHA1}"
77-
MONITOR_TAG="${IMAGE_TAG}-ubi8-${CIRCLE_SHA1}"
76+
OPERATOR_TAG="${IMAGE_TAG}-ubi8-${CIRCLE_SHA1:0:8}"
77+
MONITOR_TAG="${IMAGE_TAG}-ubi8-${CIRCLE_SHA1:0:8}"
7878
scripts/operator/create_operator_and_push.py "${OPERATOR_TAG}" "${MONITOR_TAG}" "${DOCKERHUB_USER}" "${DOCKERHUB_PASSWORD}"
7979
echo "export OPERATOR_TAG=$OPERATOR_TAG" >> $BASH_ENV
8080
name: Create Operator and push Operator image to DockerHub
@@ -86,16 +86,16 @@ jobs:
8686
- run:
8787
command: |
8888
export IMAGE_TAG=$([[ "$CIRCLE_BRANCH" == "staging" ]] && echo "staging-candidate" || echo "discardable")
89-
export SNYK_MONITOR_IMAGE_TAG="${IMAGE_TAG}-ubi8-${CIRCLE_SHA1}"
90-
export SNYK_OPERATOR_VERSION="0.0.1-ubi8-${CIRCLE_SHA1}"
89+
export SNYK_MONITOR_IMAGE_TAG="${IMAGE_TAG}-ubi8-${CIRCLE_SHA1:0:8}"
90+
export SNYK_OPERATOR_VERSION="0.0.1-ubi8-${CIRCLE_SHA1:0:8}"
9191
export SNYK_OPERATOR_IMAGE_TAG="${SNYK_MONITOR_IMAGE_TAG}"
9292
OPERATOR_PATH=$(scripts/operator/package_operator_bundle.py "${SNYK_OPERATOR_VERSION}" "${SNYK_OPERATOR_IMAGE_TAG}" "${SNYK_MONITOR_IMAGE_TAG}")
9393
echo "export OPERATOR_PATH=$OPERATOR_PATH" >> $BASH_ENV
9494
name: Package Operator Bundle
9595
- run:
9696
command: |
9797
export OPERATOR_DIR=$OPERATOR_PATH
98-
export PACKAGE_VERSION="0.0.1-ubi8-${CIRCLE_SHA1}"
98+
export PACKAGE_VERSION="0.0.1-ubi8-${CIRCLE_SHA1:0:8}"
9999
scripts/operator/create_operator_bundle_and_index_and_push.py "${OPERATOR_DIR}" "${PACKAGE_VERSION}" "${DOCKERHUB_USER}" "${DOCKERHUB_PASSWORD}"
100100
name: Create Operator Bundle and Index and push to Docker Hub
101101
- run:
@@ -114,7 +114,7 @@ jobs:
114114
command: |
115115
IMAGE_TAG=$([[ "$CIRCLE_BRANCH" == "staging" ]] && echo "staging-candidate" || echo "discardable")
116116
IMAGE_NAME_CANDIDATE=snyk/kubernetes-monitor:${IMAGE_TAG}-${CIRCLE_SHA1}
117-
IMAGE_NAME_CANDIDATE_UBI8=snyk/kubernetes-monitor:${IMAGE_TAG}-ubi8-${CIRCLE_SHA1}
117+
IMAGE_NAME_CANDIDATE_UBI8=snyk/kubernetes-monitor:${IMAGE_TAG}-ubi8-${CIRCLE_SHA1:0:8}
118118
echo "export IMAGE_NAME_CANDIDATE=$IMAGE_NAME_CANDIDATE" >> $BASH_ENV
119119
echo "export IMAGE_NAME_CANDIDATE_UBI8=$IMAGE_NAME_CANDIDATE_UBI8" >> $BASH_ENV
120120
name: Export environment variables
@@ -341,7 +341,7 @@ jobs:
341341
name: Create temporary directory for logs
342342
- run:
343343
command: |
344-
export OPERATOR_VERSION="0.0.1-ubi8-${CIRCLE_SHA1}"
344+
export OPERATOR_VERSION="0.0.1-ubi8-${CIRCLE_SHA1:0:8}"
345345
export IMAGE_TAG_UBI_SUFFIX="-ubi8"
346346
export KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG=$(./scripts/circleci-jobs/setup-integration-tests.py)
347347
.circleci/do-exclusively --branch staging --job ${CIRCLE_JOB} npm run test:integration:kindolm:operator
@@ -433,7 +433,7 @@ jobs:
433433
name: create temp dir for logs
434434
- run:
435435
command: |
436-
export OPERATOR_VERSION="0.0.1-ubi8-${CIRCLE_SHA1}"
436+
export OPERATOR_VERSION="0.0.1-ubi8-${CIRCLE_SHA1:0:8}"
437437
export IMAGE_TAG_UBI_SUFFIX="-ubi8"
438438
export KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG=$(./scripts/circleci-jobs/setup-integration-tests.py)
439439
.circleci/do-exclusively --branch staging --job ${CIRCLE_JOB} npm run test:integration:openshift4:operator

.circleci/config/jobs/build_and_upload_operator.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ steps:
1717
name: Create Operator and push Operator image to DockerHub
1818
command: |
1919
export IMAGE_TAG=$([[ "$CIRCLE_BRANCH" == "staging" ]] && echo "staging-candidate" || echo "discardable")
20-
OPERATOR_TAG="${IMAGE_TAG}-ubi8-${CIRCLE_SHA1}"
21-
MONITOR_TAG="${IMAGE_TAG}-ubi8-${CIRCLE_SHA1}"
20+
OPERATOR_TAG="${IMAGE_TAG}-ubi8-${CIRCLE_SHA1:0:8}"
21+
MONITOR_TAG="${IMAGE_TAG}-ubi8-${CIRCLE_SHA1:0:8}"
2222
scripts/operator/create_operator_and_push.py "${OPERATOR_TAG}" "${MONITOR_TAG}" "${DOCKERHUB_USER}" "${DOCKERHUB_PASSWORD}"
2323
echo "export OPERATOR_TAG=$OPERATOR_TAG" >> $BASH_ENV
2424
- snyk/scan:
@@ -30,16 +30,16 @@ steps:
3030
name: Package Operator Bundle
3131
command: |
3232
export IMAGE_TAG=$([[ "$CIRCLE_BRANCH" == "staging" ]] && echo "staging-candidate" || echo "discardable")
33-
export SNYK_MONITOR_IMAGE_TAG="${IMAGE_TAG}-ubi8-${CIRCLE_SHA1}"
34-
export SNYK_OPERATOR_VERSION="0.0.1-ubi8-${CIRCLE_SHA1}"
33+
export SNYK_MONITOR_IMAGE_TAG="${IMAGE_TAG}-ubi8-${CIRCLE_SHA1:0:8}"
34+
export SNYK_OPERATOR_VERSION="0.0.1-ubi8-${CIRCLE_SHA1:0:8}"
3535
export SNYK_OPERATOR_IMAGE_TAG="${SNYK_MONITOR_IMAGE_TAG}"
3636
OPERATOR_PATH=$(scripts/operator/package_operator_bundle.py "${SNYK_OPERATOR_VERSION}" "${SNYK_OPERATOR_IMAGE_TAG}" "${SNYK_MONITOR_IMAGE_TAG}")
3737
echo "export OPERATOR_PATH=$OPERATOR_PATH" >> $BASH_ENV
3838
- run:
3939
name: Create Operator Bundle and Index and push to Docker Hub
4040
command: |
4141
export OPERATOR_DIR=$OPERATOR_PATH
42-
export PACKAGE_VERSION="0.0.1-ubi8-${CIRCLE_SHA1}"
42+
export PACKAGE_VERSION="0.0.1-ubi8-${CIRCLE_SHA1:0:8}"
4343
scripts/operator/create_operator_bundle_and_index_and_push.py "${OPERATOR_DIR}" "${PACKAGE_VERSION}" "${DOCKERHUB_USER}" "${DOCKERHUB_PASSWORD}"
4444
- run:
4545
name: Notify Slack on failure

.circleci/config/jobs/build_image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ steps:
99
command: |
1010
IMAGE_TAG=$([[ "$CIRCLE_BRANCH" == "staging" ]] && echo "staging-candidate" || echo "discardable")
1111
IMAGE_NAME_CANDIDATE=snyk/kubernetes-monitor:${IMAGE_TAG}-${CIRCLE_SHA1}
12-
IMAGE_NAME_CANDIDATE_UBI8=snyk/kubernetes-monitor:${IMAGE_TAG}-ubi8-${CIRCLE_SHA1}
12+
IMAGE_NAME_CANDIDATE_UBI8=snyk/kubernetes-monitor:${IMAGE_TAG}-ubi8-${CIRCLE_SHA1:0:8}
1313
echo "export IMAGE_NAME_CANDIDATE=$IMAGE_NAME_CANDIDATE" >> $BASH_ENV
1414
echo "export IMAGE_NAME_CANDIDATE_UBI8=$IMAGE_NAME_CANDIDATE_UBI8" >> $BASH_ENV
1515
- run:

.circleci/config/jobs/integration_tests_operator_on_k8s.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ steps:
1111
- run:
1212
name: Operator integration tests on vanilla Kubernetes
1313
command: |
14-
export OPERATOR_VERSION="0.0.1-ubi8-${CIRCLE_SHA1}"
14+
export OPERATOR_VERSION="0.0.1-ubi8-${CIRCLE_SHA1:0:8}"
1515
export IMAGE_TAG_UBI_SUFFIX="-ubi8"
1616
export KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG=$(./scripts/circleci-jobs/setup-integration-tests.py)
1717
.circleci/do-exclusively --branch staging --job ${CIRCLE_JOB} npm run test:integration:kindolm:operator

.circleci/config/jobs/openshift4_integration_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ steps:
1212
- run:
1313
name: Integration tests OpenShift 4
1414
command: |
15-
export OPERATOR_VERSION="0.0.1-ubi8-${CIRCLE_SHA1}"
15+
export OPERATOR_VERSION="0.0.1-ubi8-${CIRCLE_SHA1:0:8}"
1616
export IMAGE_TAG_UBI_SUFFIX="-ubi8"
1717
export KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG=$(./scripts/circleci-jobs/setup-integration-tests.py)
1818
.circleci/do-exclusively --branch staging --job ${CIRCLE_JOB} npm run test:integration:openshift4:operator

scripts/docker/approve-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ else
1616
docker push ${IMAGE_NAME_APPROVED}
1717
./scripts/slack/notify_push.py ${IMAGE_NAME_APPROVED}
1818

19-
IMAGE_NAME_CANDIDATE_UBI8=snyk/kubernetes-monitor:staging-candidate-ubi8-${CIRCLE_SHA1}
19+
IMAGE_NAME_CANDIDATE_UBI8=snyk/kubernetes-monitor:staging-candidate-ubi8-${CIRCLE_SHA1:0:8}
2020
IMAGE_NAME_APPROVED_UBI8=snyk/kubernetes-monitor:${1}-ubi8-approved
2121

2222
docker pull ${IMAGE_NAME_CANDIDATE_UBI8}

scripts/operator/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
if __name__ == '__main__':
2828
random_digest = sha1(str(datetime.now()).encode("utf-8")).hexdigest()
29-
operator_version = "0.0.1-" + random_digest
29+
operator_version = "0.0.1-ubi8-" + random_digest[0:8]
3030

3131
with open(getcwd() + "/" + ".operator_version", "w") as f:
3232
f.write(operator_version)

0 commit comments

Comments
 (0)