Skip to content

Commit 81e34cb

Browse files
Merge pull request #772 from perdasilva/fixci413-2
[release-4.13] OCPBUGS-35241: Unblock CI
2 parents 4cc5232 + e389e30 commit 81e34cb

File tree

6 files changed

+92
-7
lines changed

6 files changed

+92
-7
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ e2e/operator-registry: ## Run e2e registry tests
127127
$(MAKE) e2e WHAT=operator-registry
128128

129129
e2e/olm: ## Run e2e olm tests
130-
$(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
130+
# the operator-registry version is pinned to v1.39.0 - later versions are not compatible with 4.12
131+
# this is important for a few tests would rely on :latest
132+
$(MAKE) e2e OPERATOR_REGISTRY_TAG=v1.39.0 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
131133

132134
.PHONY: update-plugin-deps
133135
update-plugin-deps:

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

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

staging/operator-lifecycle-manager/Makefile

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ GO := GO111MODULE=on GOFLAGS="$(MOD_FLAGS)" go
2929
GINKGO := $(GO) run github.com/onsi/ginkgo/v2/ginkgo
3030
BINDATA := $(GO) run github.com/go-bindata/go-bindata/v3/go-bindata
3131
GIT_COMMIT := $(shell git rev-parse HEAD)
32+
ifeq ($(shell arch), arm64)
33+
ARCH := arm64
34+
else
35+
ARCH := 386
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)
3244

3345
# Phony prerequisite for targets that rely on the go build cache to determine staleness.
3446
.PHONY: build test clean vendor \
@@ -223,31 +235,41 @@ verify-manifests: manifests
223235

224236
verify: verify-codegen verify-mockgen verify-manifests
225237

238+
.PHONY: pull-opm
239+
pull-opm:
240+
docker pull $(OPERATOR_REGISTRY_IMAGE)
241+
226242
# before running release, bump the version in OLM_VERSION and push to master,
227243
# then tag those builds in quay with the version in OLM_VERSION
228244
release: ver=v$(shell cat OLM_VERSION)
229-
release: manifests
245+
# pull the opm image to get the digest
246+
release: pull-opm manifests
230247
@echo "Generating the $(ver) release"
231248
docker pull $(IMAGE_REPO):$(ver)
232249
$(MAKE) target=upstream ver=$(ver) quickstart=true package
233250

234251
package: olmref=$(shell docker inspect --format='{{index .RepoDigests 0}}' $(IMAGE_REPO):$(ver))
252+
package: opmref=$(shell docker inspect --format='{{index .RepoDigests 0}}' $(OPERATOR_REGISTRY_IMAGE))
235253
package:
236254
ifndef target
237255
$(error target is undefined)
238256
endif
239257
ifndef ver
240258
$(error ver is undefined)
241259
endif
260+
@echo "Getting operator registry image"
261+
docker pull $(OPERATOR_REGISTRY_IMAGE)
242262
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml olm.image.ref $(olmref)
243263
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml catalog.image.ref $(olmref)
244264
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml package.image.ref $(olmref)
265+
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml -- catalog.opmImageArgs "--opmImage=$(opmref)"
245266
./scripts/package_release.sh $(ver) deploy/$(target)/manifests/$(ver) deploy/$(target)/values.yaml
246267
ln -sfFn ./$(ver) deploy/$(target)/manifests/latest
247268
ifeq ($(quickstart), true)
248269
./scripts/package_quickstart.sh deploy/$(target)/manifests/$(ver) deploy/$(target)/quickstart/olm.yaml deploy/$(target)/quickstart/crds.yaml deploy/$(target)/quickstart/install.sh
249270
endif
250271

272+
251273
################################
252274
# OLM - Install/Uninstall/Run #
253275
################################

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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3923,9 +3923,10 @@ func TestUpdates(t *testing.T) {
39233923
simulateSuccessfulRollout(current, op.opClient)
39243924
}
39253925
for current.Status.Phase != e.whenIn.phase {
3926-
fmt.Printf("waiting for (when) %s to be %s\n", e.whenIn.name, e.whenIn.phase)
39273926
csvsToSync = syncCSVs(csvsToSync, deletedCSVs(e.shouldBe))
39283927
current = csvsToSync[e.whenIn.name]
3928+
fmt.Printf("waiting for (when) %s to be %s\n", e.whenIn.name, e.whenIn.phase)
3929+
time.Sleep(1 * time.Second)
39293930
}
39303931

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

staging/operator-lifecycle-manager/test/e2e/magic_catalog.go

Lines changed: 6 additions & 1 deletion
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/upstream-opm-builder"
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)