Skip to content

Commit 1f5e0dc

Browse files
perdasilvaPer Goncalves da Silva
and
Per Goncalves da Silva
authored
🌱 parameterizes the e2e target and pins opm images (#3275)
* parameterize e2e target Signed-off-by: Per Goncalves da Silva <[email protected]> * pin opm image Signed-off-by: Per Goncalves da Silva <[email protected]> * update default chart values to point to pinned opm image Signed-off-by: Per Goncalves da Silva <[email protected]> --------- Signed-off-by: Per Goncalves da Silva <[email protected]> Co-authored-by: Per Goncalves da Silva <[email protected]>
1 parent f9485ff commit 1f5e0dc

File tree

4 files changed

+39
-10
lines changed

4 files changed

+39
-10
lines changed

.github/workflows/e2e-tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464

6565
# set e2e environment variables
6666
# Set ginkgo output and parallelism
67-
- run: echo "GINKGO_E2E_OPTS=-output-dir ${ARTIFACT_DIR} -junit-report junit_e2e.xml -nodes ${E2E_NODES}" >> $GITHUB_ENV
67+
- run: echo "GINKGO_OPTS=-output-dir ${ARTIFACT_DIR} -junit-report junit_e2e.xml -nodes ${E2E_NODES}" >> $GITHUB_ENV
6868

6969
# Setting -kubeconfig-root tells the e2e test suite to look for kubeconfigs
7070
# in <kubeconfig-root>/kubeconfig-<node-number>
@@ -98,15 +98,15 @@ jobs:
9898
# focus on those tests and skip tests marked as FLAKE
9999
run: |
100100
E2E_TEST_NUM_CHUNKS=$(( ${{ strategy.job-total }} - 1 )) \
101-
GINKGO_E2E_OPTS="${GINKGO_E2E_OPTS} -focus '$(go run ./test/e2e/split/... -chunks $E2E_TEST_NUM_CHUNKS -print-chunk $E2E_TEST_CHUNK ./test/e2e)' -skip '\[FLAKE\]'" \
101+
GINKGO_OPTS="${GINKGO_OPTS} -focus '$(go run ./test/e2e/split/... -chunks $E2E_TEST_NUM_CHUNKS -print-chunk $E2E_TEST_CHUNK ./test/e2e)' -skip '\[FLAKE\]'" \
102102
make e2e;
103103
104104
# run e2e tests for flakes if matrix-id is 'flakes'
105105
- name: Run flaky e2e tests
106106
if: ${{ matrix.parallel-id == 'flakes' }}
107107
# focus on tests marked as FLAKE
108108
run: |
109-
GINKGO_E2E_OPTS="${GINKGO_E2E_OPTS} -focus '\[FLAKE\]'" make e2e
109+
GINKGO_OPTS="${GINKGO_OPTS} -focus '\[FLAKE\]'" make e2e
110110
111111
# archive test results
112112
- name: Archive Test Artifacts

Makefile

+29-6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ KIND_NODE_VERSION ?= $(KUBE_MINOR).0
5252
KIND_CLUSTER_NAME ?= kind-olmv0
5353
KIND_CLUSTER_IMAGE := kindest/node:v$(KIND_NODE_VERSION)
5454

55+
# Take operator registry tag from operator registry version in go.mod
56+
export OPERATOR_REGISTRY_TAG ?= $(shell go list -m github.com/operator-framework/operator-registry | cut -d" " -f2)
57+
58+
# Pin operator registry images to the OPERATOR_REGISTRY_TAG
59+
export OPERATOR_REGISTRY_IMAGE ?= quay.io/operator-framework/opm:$(OPERATOR_REGISTRY_TAG)
60+
export CONFIGMAP_SERVER_IMAGE ?= quay.io/operator-framework/configmap-operator-registry:$(OPERATOR_REGISTRY_TAG)
61+
5562
# Phony prerequisite for targets that rely on the go build cache to determine staleness.
5663
.PHONY: build test clean vendor \
5764
coverage coverage-html e2e \
@@ -126,10 +133,16 @@ e2e.namespace:
126133
@printf "e2e-tests-$(shell date +%s)-$$RANDOM" > e2e.namespace
127134

128135
.PHONY: e2e
129-
GINKGO_E2E_OPTS += -timeout 90m -v -randomize-suites -race -trace --show-node-events
130-
E2E_OPTS += -namespace=operators -olmNamespace=operator-lifecycle-manager -catalogNamespace=operator-lifecycle-manager -dummyImage=bitnami/nginx:latest
136+
E2E_TIMEOUT ?= 90m
137+
E2E_TEST_NS ?= operators
138+
E2E_INSTALL_NS ?= operator-lifecycle-manager
139+
E2E_CATALOG_NS ?= $(E2E_INSTALL_NS)
140+
GINKGO_OPTS += -v -randomize-suites -race -trace --show-node-events
131141
e2e:
132-
$(GINKGO) $(GINKGO_E2E_OPTS) ./test/e2e -- $(E2E_OPTS)
142+
$(GINKGO) -timeout $(E2E_TIMEOUT) $(GINKGO_OPTS) ./test/e2e -- -namespace=$(E2E_TEST_NS) -olmNamespace=$(E2E_INSTALL_NS) -catalogNamespace=$(E2E_CATALOG_NS) $(E2E_OPTS)
143+
144+
.PHONY: e2e-local
145+
e2e-local: e2e-build kind-create deploy e2e
133146

134147
.PHONY: kind-clean
135148
kind-clean:
@@ -144,12 +157,14 @@ kind-create: kind-clean
144157
OLM_IMAGE := quay.io/operator-framework/olm:local
145158
deploy:
146159
$(KIND) load docker-image $(OLM_IMAGE) --name $(KIND_CLUSTER_NAME); \
147-
$(HELM) install olm deploy/chart \
160+
$(HELM) upgrade --install olm deploy/chart \
148161
--set debug=true \
149162
--set olm.image.ref=$(OLM_IMAGE) \
150163
--set olm.image.pullPolicy=IfNotPresent \
151164
--set catalog.image.ref=$(OLM_IMAGE) \
152165
--set catalog.image.pullPolicy=IfNotPresent \
166+
--set catalog.commandArgs=--configmapServerImage=$(CONFIGMAP_SERVER_IMAGE) \
167+
--set catalog.opmImageArgs=--opmImage=$(OPERATOR_REGISTRY_IMAGE) \
153168
--set package.image.ref=$(OLM_IMAGE) \
154169
--set package.image.pullPolicy=IfNotPresent \
155170
$(HELM_INSTALL_OPTS) \
@@ -158,7 +173,6 @@ deploy:
158173
.PHONY: e2e-build
159174
e2e-build: BUILD_TAGS="json1 e2e experimental_metrics"
160175
e2e-build: export GOOS=linux
161-
e2e-build: export GOARCH=amd64
162176
e2e-build: build_cmd=build
163177
e2e-build: e2e.Dockerfile bin/wait bin/cpb $(CMDS)
164178
docker build -t quay.io/operator-framework/olm:local -f $< bin
@@ -213,25 +227,34 @@ verify-manifests: manifests
213227

214228
verify: vendor verify-codegen verify-mockgen verify-manifests
215229

230+
.PHONY: pull-opm
231+
pull-opm:
232+
docker pull $(OPERATOR_REGISTRY_IMAGE)
233+
216234
# before running release, bump the version in OLM_VERSION and push to master,
217235
# then tag those builds in quay with the version in OLM_VERSION
218236
release: ver=v$(shell cat OLM_VERSION)
219-
release: manifests
237+
# pull the opm image to get the digest
238+
release: pull-opm manifests
220239
@echo "Generating the $(ver) release"
221240
docker pull $(IMAGE_REPO):$(ver)
222241
$(MAKE) target=upstream ver=$(ver) quickstart=true package
223242

224243
package: olmref=$(shell docker inspect --format='{{index .RepoDigests 0}}' $(IMAGE_REPO):$(ver))
244+
package: opmref=$(shell docker inspect --format='{{index .RepoDigests 0}}' $(OPERATOR_REGISTRY_IMAGE))
225245
package:
226246
ifndef target
227247
$(error target is undefined)
228248
endif
229249
ifndef ver
230250
$(error ver is undefined)
231251
endif
252+
@echo "Getting operator registry image"
253+
docker pull $(OPERATOR_REGISTRY_IMAGE)
232254
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml olm.image.ref $(olmref)
233255
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml catalog.image.ref $(olmref)
234256
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml package.image.ref $(olmref)
257+
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml -- catalog.opmImageArgs "--opmImage=$(opmref)"
235258
./scripts/package_release.sh $(ver) deploy/$(target)/manifests/$(ver) deploy/$(target)/values.yaml
236259
ln -sfFn ./$(ver) deploy/$(target)/manifests/latest
237260
ifeq ($(quickstart), true)

deploy/chart/values.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ catalog:
4040
setWorkloadUserID: true
4141
replicaCount: 1
4242
commandArgs: --configmapServerImage=quay.io/operator-framework/configmap-operator-registry:latest
43+
opmImageArgs: --opmImage=quay.io/operator-framework/opm:latest
4344
image:
4445
ref: quay.io/operator-framework/olm:master
4546
pullPolicy: Always

test/e2e/magic_catalog.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package e2e
33
import (
44
"context"
55
"fmt"
6+
"os"
67

78
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
89
corev1 "k8s.io/api/core/v1"
@@ -257,12 +258,16 @@ func (c *MagicCatalog) makeCatalogSource() *operatorsv1alpha1.CatalogSource {
257258
func (c *MagicCatalog) makeCatalogSourcePod() *corev1.Pod {
258259

259260
const (
260-
image = "quay.io/operator-framework/opm"
261261
readinessDelay int32 = 5
262262
livenessDelay int32 = 10
263263
volumeMountName string = "fbc-catalog"
264264
)
265265

266+
var image = "quay.io/operator-framework/opm"
267+
if os.Getenv("OPERATOR_REGISTRY_TAG") != "" {
268+
image = fmt.Sprintf("quay.io/operator-framework/opm:%s", os.Getenv("OPERATOR_REGISTRY_TAG"))
269+
}
270+
266271
return &corev1.Pod{
267272
ObjectMeta: metav1.ObjectMeta{
268273
Name: c.podName,

0 commit comments

Comments
 (0)