Skip to content

Commit 8114e18

Browse files
CLOUDP-121895: Openshift upgrade test (#587)
Openshift upgrade test
1 parent 80ae2b6 commit 8114e18

File tree

4 files changed

+392
-18
lines changed

4 files changed

+392
-18
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Test
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
previousVersion:
7+
description: "Previous operator release"
8+
default: "1.0.0"
9+
required: false
10+
previousReleaseRegistry:
11+
description: "Previous operator registry"
12+
default: "quay.io/mongodb"
13+
required: false
14+
registryForNewRelease:
15+
description: "Registry to push images of current build"
16+
default: "quay.io/mongodb"
17+
required: false
18+
19+
concurrency:
20+
group: test-openshift-operator-upgrade
21+
cancel-in-progress: true
22+
23+
jobs:
24+
e2e-tests:
25+
name: Prepare E2E configuration and image
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Check out code
29+
uses: actions/[email protected]
30+
with:
31+
fetch-depth: 0 # required for tags
32+
33+
- name: Prepare tag
34+
id: prepare
35+
uses: ./.github/actions/set-tag
36+
37+
- name: Download tools for openshift test
38+
run: |
39+
wget https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest-4.6/opm-linux.tar.gz -O opm.tar.gz -q
40+
tar xvf opm.tar.gz
41+
chmod +x opm && sudo mv opm /usr/local/bin/opm
42+
wget https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest-4.6/openshift-client-linux.tar.gz -O openshift.tar.gz -q
43+
tar xvf openshift.tar.gz
44+
chmod +x oc && sudo mv oc /usr/local/bin/oc
45+
46+
opm version
47+
oc version
48+
49+
- name: Run openshift upgrade test
50+
run: cd scripts && ./openshift-upgrade-test.sh
51+
env:
52+
OC_TOKEN: ${{ secrets.TOKEN }}
53+
CLUSTER_API_URL: ${{ secret.OPENSHIFT_SERVER_API }}
54+
LATEST_RELEASE_REGISTRY: ${{ github.event.inputs.previousReleaseRegistry }}
55+
REGISTRY: ${{ secret.DOCKER_REGISTRY }}
56+
57+

Makefile

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# fix for some Linux distros (i.e. WSL)
22
SHELL := /usr/bin/env bash
33

4+
# CONTAINER ENGINE: docker | podman
5+
CONTAINER_ENGINE?=docker
6+
47
# VERSION defines the project version for the bundle.
58
# Update this value when you upgrade the version of your project.
69
# To re-generate a bundle for another specific version without changing the standard setup, you can:
@@ -17,7 +20,7 @@ endif
1720
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
1821
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=preview,fast,stable)
1922
# - use environment variables to overwrite this value (e.g export CHANNELS="preview,fast,stable")
20-
CHANNELS = beta
23+
CHANNELS ?= beta
2124
ifneq ($(origin CHANNELS), undefined)
2225
BUNDLE_CHANNELS := --channels=$(CHANNELS)
2326
endif
@@ -27,7 +30,7 @@ endif
2730
# To re-generate a bundle for any other default channel without changing the default setup, you can:
2831
# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
2932
# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
30-
DEFAULT_CHANNEL=beta
33+
DEFAULT_CHANNEL ?= beta
3134
ifneq ($(origin DEFAULT_CHANNEL), undefined)
3235
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
3336
endif
@@ -88,6 +91,10 @@ int-test: generate manifests ## Run integration tests. Sample with labels: `make
8891
e2e: run-kind ## Run e2e test. Command `make e2e label=cluster-ns` run cluster-ns test
8992
./scripts/e2e_local.sh $(label) $(build)
9093

94+
.PHONY: e2e-openshift-upgrade
95+
e2e-openshift-upgrade:
96+
cd scripts && ./openshift-upgrade-test.sh
97+
9198
.PHONY: manager
9299
manager: generate fmt vet ## Build manager binary
93100
go build -o bin/manager -ldflags="-X main.version=$(PRODUCT_VERSION)" cmd/manager/main.go
@@ -163,20 +170,19 @@ bundle: manifests kustomize ## Generate bundle manifests and metadata, then vali
163170

164171
.PHONY: image
165172
image: manager ## Build the operator image
166-
docker build -t $(OPERATOR_IMAGE) .
167-
docker push $(OPERATOR_IMAGE)
173+
$(CONTAINER_ENGINE) build -t $(OPERATOR_IMAGE) .
174+
$(CONTAINER_ENGINE) push $(OPERATOR_IMAGE)
168175

169176
.PHONY: bundle-build
170177
bundle-build: ## Build the bundle image.
171-
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
178+
$(CONTAINER_ENGINE) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
172179

173180
.PHONY: bundle-push
174-
bundle-push: bundle bundle-build ## Publish the bundle image
175-
docker push $(BUNDLE_IMG)
181+
bundle-push:
182+
$(CONTAINER_ENGINE) push $(BUNDLE_IMG)
176183

177184
.PHONY: catalog-build
178185
CATALOG_DIR ?= ./scripts/openshift/atlas-catalog
179-
#catalog-build: IMG=
180186
catalog-build: ## bundle bundle-push ## Build file-based bundle
181187
$(MAKE) image IMG=$(REGISTRY)/mongodb-atlas-operator:$(VERSION)
182188
CATALOG_DIR=$(CATALOG_DIR) \
@@ -188,7 +194,7 @@ catalog-build: ## bundle bundle-push ## Build file-based bundle
188194

189195
.PHONY: catalog-push
190196
catalog-push:
191-
docker push $(CATALOG_IMAGE)
197+
$(CONTAINER_ENGINE) push $(CATALOG_IMAGE)
192198

193199
.PHONY: build-subscription
194200
build-subscription:
@@ -219,9 +225,9 @@ deploy-olm: bundle-build bundle-push catalog-build catalog-push build-catalogsou
219225
## docker-login-olm:
220226
## docker login -u $(shell oc whoami) -p $(shell oc whoami -t) $(REGISTRY)
221227

222-
.PHONY: docker-push
223-
docker-push: ## Push the docker image
224-
docker push ${IMG}
228+
.PHONY: image-push
229+
image-push: ## Push the docker image
230+
$(CONTAINER_ENGINE) push ${IMG}
225231

226232
# Additional make goals
227233
.PHONY: run-kind

0 commit comments

Comments
 (0)