@@ -34,6 +34,14 @@ ARCH := arm64
34
34
else
35
35
ARCH := 386
36
36
endif
37
+
38
+ # Take operator registry tag from operator registry version in go.mod
39
+ export OPERATOR_REGISTRY_TAG ?= $(shell go list -m github.com/operator-framework/operator-registry | cut -d" " -f2)
40
+
41
+ # Pin operator registry images to the OPERATOR_REGISTRY_TAG
42
+ export OPERATOR_REGISTRY_IMAGE ?= quay.io/operator-framework/opm :$(OPERATOR_REGISTRY_TAG )
43
+ export CONFIGMAP_SERVER_IMAGE ?= quay.io/operator-framework/configmap-operator-registry :$(OPERATOR_REGISTRY_TAG )
44
+
37
45
# Phony prerequisite for targets that rely on the go build cache to determine staleness.
38
46
.PHONY : build test clean vendor \
39
47
coverage coverage-html e2e \
@@ -123,29 +131,18 @@ deploy-local:
123
131
e2e.namespace :
124
132
@printf " e2e-tests-$( shell date +%s) -$$ RANDOM" > e2e.namespace
125
133
126
- # useful if running e2e directly with `go test -tags=bare`
127
- setup-bare : clean e2e.namespace
128
- . ./scripts/build_bare.sh
129
- . ./scripts/package_release.sh 1.0.0 test/e2e/resources test/e2e/e2e-bare-values.yaml
130
- . ./scripts/install_bare.sh $(shell cat ./e2e.namespace) test/e2e/resources
131
-
132
- E2E_NODES ?= 1
133
- E2E_FLAKE_ATTEMPTS ?= 1
134
+ .PHONY : e2e
134
135
E2E_TIMEOUT ?= 90m
135
- # Optionally run an individual chunk of e2e test specs.
136
- # Do not use this from the CLI; this is intended to be used by CI only.
137
- E2E_TEST_CHUNK ?= all
138
- E2E_TEST_NUM_CHUNKS ?= 4
139
- ifneq (all,$(E2E_TEST_CHUNK ) )
140
- TEST := $(shell go run ./test/e2e/split/... -chunks $(E2E_TEST_NUM_CHUNKS ) -print-chunk $(E2E_TEST_CHUNK ) ./test/e2e)
141
- endif
142
- E2E_OPTS ?= $(if $(E2E_SEED ) ,-seed '$(E2E_SEED ) ') $(if $(SKIP ) , -skip '$(SKIP ) ') $(if $(TEST ) ,-focus '$(TEST ) ') $(if $(ARTIFACT_DIR ) , -output-dir $(ARTIFACT_DIR ) -junit-report junit_e2e.xml) -flake-attempts $(E2E_FLAKE_ATTEMPTS ) -nodes $(E2E_NODES ) -timeout $(E2E_TIMEOUT ) -v -randomize-suites -race -trace -progress
136
+ E2E_TEST_NS ?= operators
143
137
E2E_INSTALL_NS ?= operator-lifecycle-manager
144
138
E2E_CATALOG_NS ?= $(E2E_INSTALL_NS )
145
- E2E_TEST_NS ?= operators
146
-
139
+ E2E_FLAKE_ATTEMPTS ?= 1
140
+ GINKGO_OPTS += -v -randomize-suites -race -trace --show-node-events --flake-attempts= $( E2E_FLAKE_ATTEMPTS ) $( if $( E2E_SEED ) ,-seed ' $( E2E_SEED ) ') $( if $( TEST ) ,-focus ' $( TEST ) ',) $( if $( SKIP ) , -skip ' $( SKIP ) ')
147
141
e2e :
148
- $(GINKGO ) $(E2E_OPTS ) $(or $(run ) , ./test/e2e) $< -- -namespace=$(E2E_TEST_NS ) -olmNamespace=$(E2E_INSTALL_NS ) -catalogNamespace=$(E2E_CATALOG_NS ) -dummyImage=bitnami/nginx:latest $(or $(extra_args ) , -kubeconfig=${KUBECONFIG})
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
149
146
150
147
# See workflows/e2e-tests.yml See test/e2e/README.md for details.
151
148
.PHONY : e2e-local
@@ -161,15 +158,28 @@ e2e-local: e2e
161
158
test/e2e/assets/chart/zz_chart.go : $(shell find deploy/chart -type f)
162
159
$(BINDATA ) -o $@ -pkg chart -prefix deploy/chart/ $^
163
160
164
- # execute kind and helm end to end tests
165
- bin/e2e-local.test : FORCE test/e2e/assets/chart/zz_chart.go
166
- $(GO ) test -c -tags kind,helm -o $@ ./test/e2e
167
-
168
- # set go env and other vars, ensure that the dockerfile exists, and then build wait, cpb, and other command binaries and finally the kind image archive
169
- test/e2e-local.image.tar : export GOOS=linux
170
- test/e2e-local.image.tar : export GOARCH=386
171
- test/e2e-local.image.tar : build_cmd=build
172
- test/e2e-local.image.tar : e2e.Dockerfile bin/wait bin/cpb $(CMDS )
161
+ .PHONY : deploy
162
+ OLM_IMAGE := quay.io/operator-framework/olm:local
163
+ deploy :
164
+ $(KIND ) load docker-image $(OLM_IMAGE ) --name $(KIND_CLUSTER_NAME ) ; \
165
+ $(HELM ) upgrade --install olm deploy/chart \
166
+ --set debug=true \
167
+ --set olm.image.ref=$(OLM_IMAGE ) \
168
+ --set olm.image.pullPolicy=IfNotPresent \
169
+ --set catalog.image.ref=$(OLM_IMAGE ) \
170
+ --set catalog.image.pullPolicy=IfNotPresent \
171
+ --set catalog.commandArgs=--configmapServerImage=$(CONFIGMAP_SERVER_IMAGE ) \
172
+ --set catalog.opmImageArgs=--opmImage=$(OPERATOR_REGISTRY_IMAGE ) \
173
+ --set package.image.ref=$(OLM_IMAGE ) \
174
+ --set package.image.pullPolicy=IfNotPresent \
175
+ $(HELM_INSTALL_OPTS ) \
176
+ --wait;
177
+
178
+ .PHONY : e2e-build
179
+ e2e-build : BUILD_TAGS="json1 e2e experimental_metrics"
180
+ e2e-build : export GOOS=linux
181
+ e2e-build : build_cmd=build
182
+ e2e-build : e2e.Dockerfile bin/wait bin/cpb $(CMDS )
173
183
docker build -t quay.io/operator-framework/olm:local -f $< bin
174
184
docker save -o $@ quay.io/operator-framework/olm:local
175
185
@@ -180,10 +190,6 @@ e2e-local-docker:
180
190
. ./scripts/build_local.sh
181
191
. ./scripts/run_e2e_docker.sh $(TEST )
182
192
183
- vendor :
184
- go mod tidy
185
- go mod vendor
186
-
187
193
container :
188
194
docker build -t $(IMAGE_REPO ) :$(IMAGE_TAG ) .
189
195
@@ -230,25 +236,34 @@ verify-manifests: manifests
230
236
231
237
verify : verify-codegen verify-mockgen verify-manifests
232
238
239
+ .PHONY : pull-opm
240
+ pull-opm :
241
+ docker pull $(OPERATOR_REGISTRY_IMAGE )
242
+
233
243
# before running release, bump the version in OLM_VERSION and push to master,
234
244
# then tag those builds in quay with the version in OLM_VERSION
235
245
release : ver=v$(shell cat OLM_VERSION)
236
- release : manifests
246
+ # pull the opm image to get the digest
247
+ release : pull-opm manifests
237
248
@echo " Generating the $( ver) release"
238
249
docker pull $(IMAGE_REPO ) :$(ver )
239
250
$(MAKE ) target=upstream ver=$(ver ) quickstart=true package
240
251
241
252
package : olmref=$(shell docker inspect --format='{{index .RepoDigests 0}}' $(IMAGE_REPO ) :$(ver ) )
253
+ package : opmref=$(shell docker inspect --format='{{index .RepoDigests 0}}' $(OPERATOR_REGISTRY_IMAGE ) )
242
254
package :
243
255
ifndef target
244
256
$(error target is undefined)
245
257
endif
246
258
ifndef ver
247
259
$(error ver is undefined)
248
260
endif
261
+ @echo "Getting operator registry image"
262
+ docker pull $(OPERATOR_REGISTRY_IMAGE)
249
263
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml olm.image.ref $(olmref)
250
264
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml catalog.image.ref $(olmref)
251
265
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml package.image.ref $(olmref)
266
+ $(YQ_INTERNAL) w -i deploy/$(target)/values.yaml -- catalog.opmImageArgs "--opmImage=$(opmref)"
252
267
./scripts/package_release.sh $(ver) deploy/$(target)/manifests/$(ver) deploy/$(target)/values.yaml
253
268
ln -sfFn ./$(ver) deploy/$(target)/manifests/latest
254
269
ifeq ($(quickstart ) , true)
0 commit comments