Skip to content

Commit 1aacee6

Browse files
Merge pull request #767 from perdasilva/fixci416-2
[release-4.16] OCPBUGS-35219: Unblock CI
2 parents 56b7b9d + ae0494a commit 1aacee6

37 files changed

+526
-398
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ e2e/operator-registry: ## Run e2e registry tests
130130
$(MAKE) e2e WHAT=operator-registry
131131

132132
e2e/olm: ## Run e2e olm tests
133-
$(MAKE) e2e WHAT=operator-lifecycle-manager E2E_CATALOG_NS=openshift-marketplace E2E_INSTALL_NS=openshift-operator-lifecycle-manager E2E_TEST_NS=openshift-operators E2E_TIMEOUT=120m KUBECTL=oc
133+
$(MAKE) e2e WHAT=operator-lifecycle-manager E2E_FLAKE_ATTEMPTS=0 E2E_CATALOG_NS=openshift-marketplace E2E_INSTALL_NS=openshift-operator-lifecycle-manager E2E_TEST_NS=openshift-operators E2E_TIMEOUT=120m KUBECTL=oc E2E_OPTS="-communityOperators=quay.io/olmtest/test-catalog:v1.39.0"
134134

135135
.PHONY: vendor
136136
vendor:

staging/operator-lifecycle-manager/.github/workflows/e2e-tests.yml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,63 @@ jobs:
2020
- uses: actions/setup-go@v4
2121
with:
2222
go-version-file: "go.mod"
23-
- run: mkdir -p artifacts
24-
- run: make e2e-local E2E_TEST_CHUNK=${{ matrix.parallel-id }} E2E_TEST_NUM_CHUNKS=${{ strategy.job-total }} E2E_NODES=2 ARTIFACT_DIR=./artifacts/ SKIP='\[FLAKE\]'
25-
- name: Archive Test Artifacts # test results, failed or not, are always uploaded.
23+
24+
# load the olm image
25+
- name: Load OLM Docker image
26+
uses: actions/download-artifact@v4
27+
with:
28+
name: olm-image.tar
29+
path: .
30+
- run: docker load < olm-image.tar
31+
32+
# set e2e environment variables
33+
# Set ginkgo output and parallelism
34+
- run: echo "GINKGO_OPTS=-output-dir ${ARTIFACT_DIR} -junit-report junit_e2e.xml -nodes ${E2E_NODES}" >> $GITHUB_ENV
35+
36+
# Setting -kubeconfig-root tells the e2e test suite to look for kubeconfigs
37+
# in <kubeconfig-root>/kubeconfig-<node-number>
38+
# This is used to run tests in parallel on multiple clusters as the current e2e
39+
# test suite does not support running tests in parallel on a single cluster
40+
- run: echo "E2E_OPTS=-kubeconfig-root=${E2E_KUBECONFIG_ROOT}" >> $GITHUB_ENV
41+
42+
# run e2e tests
43+
# create artifacts directory
44+
- run: mkdir -p ${ARTIFACT_DIR}
45+
46+
# deploy test clusters
47+
- name: Deploy test cluster(s)
48+
# create kubeconfig root and store the kubeconfig for each cluster within it as you create the clusters
49+
# Add kind and helm options to specify kubeconfig location
50+
# Deploy the new cluster and helm install olm for testing
51+
run: |
52+
mkdir -p ${E2E_KUBECONFIG_ROOT}
53+
for i in $(seq 1 ${E2E_NODES}); do
54+
KIND_CLUSTER_NAME="kind-olmv0-${i}" \
55+
KIND_CREATE_OPTS="--kubeconfig=${E2E_KUBECONFIG_ROOT}/kubeconfig-${i}" \
56+
HELM_INSTALL_OPTS="--kubeconfig ${E2E_KUBECONFIG_ROOT}/kubeconfig-${i}" \
57+
make kind-create deploy;
58+
done
59+
60+
# run non-flakes if matrix-id is not 'flakes'
61+
- name: Run e2e tests
62+
if: ${{ matrix.parallel-id != 'flakes' }}
63+
# calculate the number of chunks as the number of parallel jobs minus 1 (flakes job)
64+
# use the split tool to split the test suite into chunks and run the chunk corresponding to the matrix-id
65+
# focus on those tests and skip tests marked as FLAKE
66+
run: |
67+
E2E_TEST_NUM_CHUNKS=$(( ${{ strategy.job-total }} - 1 )) \
68+
GINKGO_OPTS="${GINKGO_OPTS} -focus '$(go run ./test/e2e/split/... -chunks $E2E_TEST_NUM_CHUNKS -print-chunk $E2E_TEST_CHUNK ./test/e2e)' -skip '\[FLAKE\]'" \
69+
make e2e;
70+
71+
# run e2e tests for flakes if matrix-id is 'flakes'
72+
- name: Run flaky e2e tests
73+
if: ${{ matrix.parallel-id == 'flakes' }}
74+
# focus on tests marked as FLAKE
75+
run: |
76+
GINKGO_OPTS="${GINKGO_OPTS} -focus '\[FLAKE\]'" make e2e
77+
78+
# archive test results
79+
- name: Archive Test Artifacts
2680
if: ${{ always() }}
2781
uses: actions/upload-artifact@v3
2882
with:

staging/operator-lifecycle-manager/Makefile

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ ARCH := arm64
3434
else
3535
ARCH := 386
3636
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+
3745
# Phony prerequisite for targets that rely on the go build cache to determine staleness.
3846
.PHONY: build test clean vendor \
3947
coverage coverage-html e2e \
@@ -123,29 +131,18 @@ deploy-local:
123131
e2e.namespace:
124132
@printf "e2e-tests-$(shell date +%s)-$$RANDOM" > e2e.namespace
125133

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
134135
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
143137
E2E_INSTALL_NS ?= operator-lifecycle-manager
144138
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)')
147141
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
149146

150147
# See workflows/e2e-tests.yml See test/e2e/README.md for details.
151148
.PHONY: e2e-local
@@ -161,15 +158,28 @@ e2e-local: e2e
161158
test/e2e/assets/chart/zz_chart.go: $(shell find deploy/chart -type f)
162159
$(BINDATA) -o $@ -pkg chart -prefix deploy/chart/ $^
163160

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)
173183
docker build -t quay.io/operator-framework/olm:local -f $< bin
174184
docker save -o $@ quay.io/operator-framework/olm:local
175185

@@ -180,10 +190,6 @@ e2e-local-docker:
180190
. ./scripts/build_local.sh
181191
. ./scripts/run_e2e_docker.sh $(TEST)
182192

183-
vendor:
184-
go mod tidy
185-
go mod vendor
186-
187193
container:
188194
docker build -t $(IMAGE_REPO):$(IMAGE_TAG) .
189195

@@ -230,25 +236,34 @@ verify-manifests: manifests
230236

231237
verify: verify-codegen verify-mockgen verify-manifests
232238

239+
.PHONY: pull-opm
240+
pull-opm:
241+
docker pull $(OPERATOR_REGISTRY_IMAGE)
242+
233243
# before running release, bump the version in OLM_VERSION and push to master,
234244
# then tag those builds in quay with the version in OLM_VERSION
235245
release: ver=v$(shell cat OLM_VERSION)
236-
release: manifests
246+
# pull the opm image to get the digest
247+
release: pull-opm manifests
237248
@echo "Generating the $(ver) release"
238249
docker pull $(IMAGE_REPO):$(ver)
239250
$(MAKE) target=upstream ver=$(ver) quickstart=true package
240251

241252
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))
242254
package:
243255
ifndef target
244256
$(error target is undefined)
245257
endif
246258
ifndef ver
247259
$(error ver is undefined)
248260
endif
261+
@echo "Getting operator registry image"
262+
docker pull $(OPERATOR_REGISTRY_IMAGE)
249263
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml olm.image.ref $(olmref)
250264
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml catalog.image.ref $(olmref)
251265
$(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)"
252267
./scripts/package_release.sh $(ver) deploy/$(target)/manifests/$(ver) deploy/$(target)/values.yaml
253268
ln -sfFn ./$(ver) deploy/$(target)/manifests/latest
254269
ifeq ($(quickstart), true)

staging/operator-lifecycle-manager/deploy/chart/values.yaml

Lines changed: 1 addition & 0 deletions
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

staging/operator-lifecycle-manager/pkg/controller/operators/olm/operator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4030,7 +4030,7 @@ func TestUpdates(t *testing.T) {
40304030
csvsToSync = syncCSVs(csvsToSync, deletedCSVs(e.shouldBe))
40314031
current = csvsToSync[e.whenIn.name]
40324032
fmt.Printf("waiting for (when) %s to be %s\n", e.whenIn.name, e.whenIn.phase)
4033-
time.Sleep(1 * time.Millisecond)
4033+
time.Sleep(1 * time.Second)
40344034
}
40354035

40364036
// sync the other csvs until they're in the expected status

0 commit comments

Comments
 (0)