From 636f77b8480aafdd370abc4a2cf4050ff46cd3dd Mon Sep 17 00:00:00 2001 From: Wesley Hayutin Date: Tue, 15 Oct 2024 13:41:31 -0600 Subject: [PATCH 01/10] run oadp-operator e2e test from the velero repo execute openshift/oadp-operator e2e tests directly against the velero repo locally or via prow ci Signed-off-by: Wesley Hayutin --- Makefile.prow | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Makefile.prow b/Makefile.prow index 1b00872675..54e29909c5 100644 --- a/Makefile.prow +++ b/Makefile.prow @@ -19,6 +19,10 @@ GOPATH := $(shell go env GOPATH) GOBIN := $(GOPATH)/bin GOSRC := $(GOPATH)/src +# Prow settings for e2e tests +E2E_TEST_DIR := /tmp/oadp-operator +E2E_TEST_BRANCH := master +VELERO_IMAGE := quay.io/konveyor/velero:latest # upstream ci target: verify-modules verify all test # we need to modify verify, test, all to avoid usage of docker CLI @@ -88,3 +92,16 @@ $(GOBIN)/golangci-lint: $(GOBIN)/setup-envtest: @echo "Installing envtest tools" go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest + +.PHONY: clone-oadp-operator +clone-oadp-operator: + @echo "Cloning oadp-operator" + rm -rf $(E2E_TEST_DIR) + git clone --depth 1 --single-branch --branch $(E2E_TEST_BRANCH) https://github.com/openshift/oadp-operator.git $(E2E_TEST_DIR) + +# to run just one test, use `make test-e2e GINKGO_ARGS="--ginkgo.focus='MySQL application CSI'"` +.PHONY: test-e2e +test-e2e: clone-oadp-operator + @echo "Running oadp-operator e2e tests" + pushd $(E2E_TEST_DIR) && export VELERO_IMAGE=$(VELERO_IMAGE) && make test-e2e && popd + From 56de37dc4441474a7d5d1ac7778703acd1bf8c64 Mon Sep 17 00:00:00 2001 From: Wesley Hayutin Date: Tue, 15 Oct 2024 14:31:14 -0600 Subject: [PATCH 02/10] update variable names, add a cleanup --- Makefile.prow | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile.prow b/Makefile.prow index 54e29909c5..dd17ef1c7b 100644 --- a/Makefile.prow +++ b/Makefile.prow @@ -20,8 +20,8 @@ GOBIN := $(GOPATH)/bin GOSRC := $(GOPATH)/src # Prow settings for e2e tests -E2E_TEST_DIR := /tmp/oadp-operator -E2E_TEST_BRANCH := master +OADP_E2E_DIR := /tmp/oadp-operator +OADP_E2E_BRANCH := master VELERO_IMAGE := quay.io/konveyor/velero:latest # upstream ci target: verify-modules verify all test @@ -96,12 +96,17 @@ $(GOBIN)/setup-envtest: .PHONY: clone-oadp-operator clone-oadp-operator: @echo "Cloning oadp-operator" - rm -rf $(E2E_TEST_DIR) - git clone --depth 1 --single-branch --branch $(E2E_TEST_BRANCH) https://github.com/openshift/oadp-operator.git $(E2E_TEST_DIR) + rm -rf $(OADP_E2E_DIR) + git clone --depth 1 --single-branch --branch $(OADP_E2E_BRANCH) https://github.com/openshift/oadp-operator.git $(OADP_E2E_DIR) + +.PHONY: clean-oadp-operator +clean-oadp-operator: + @echo "Cleaning oadp-operator" + rm -rf $(OADP_E2E_DIR) # to run just one test, use `make test-e2e GINKGO_ARGS="--ginkgo.focus='MySQL application CSI'"` .PHONY: test-e2e test-e2e: clone-oadp-operator @echo "Running oadp-operator e2e tests" - pushd $(E2E_TEST_DIR) && export VELERO_IMAGE=$(VELERO_IMAGE) && make test-e2e && popd + pushd $(OADP_E2E_DIR) && export VELERO_IMAGE=$(VELERO_IMAGE) && make test-e2e && popd From b1b75f24bbdaf492da426637f264e9b7b3a8af7c Mon Sep 17 00:00:00 2001 From: Wesley Hayutin Date: Tue, 15 Oct 2024 17:09:08 -0600 Subject: [PATCH 03/10] make sure env variable overrides default velero_image Signed-off-by: Wesley Hayutin --- Makefile.prow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.prow b/Makefile.prow index dd17ef1c7b..c6e895fa17 100644 --- a/Makefile.prow +++ b/Makefile.prow @@ -22,7 +22,7 @@ GOSRC := $(GOPATH)/src # Prow settings for e2e tests OADP_E2E_DIR := /tmp/oadp-operator OADP_E2E_BRANCH := master -VELERO_IMAGE := quay.io/konveyor/velero:latest +VELERO_IMAGE ?= quay.io/konveyor/velero:latest # upstream ci target: verify-modules verify all test # we need to modify verify, test, all to avoid usage of docker CLI From f36b26c90e8c21ab450f569ce0690e02cf7cc182 Mon Sep 17 00:00:00 2001 From: Wesley Hayutin Date: Wed, 16 Oct 2024 13:08:10 -0600 Subject: [PATCH 04/10] add options to build, push, and only test Signed-off-by: Wesley Hayutin --- Makefile.prow | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/Makefile.prow b/Makefile.prow index c6e895fa17..a126bbfa77 100644 --- a/Makefile.prow +++ b/Makefile.prow @@ -23,6 +23,12 @@ GOSRC := $(GOPATH)/src OADP_E2E_DIR := /tmp/oadp-operator OADP_E2E_BRANCH := master VELERO_IMAGE ?= quay.io/konveyor/velero:latest +LOCAL_BUILT_IMAGE=ttl.sh/velero-$(shell git rev-parse --short HEAD):1h +CLUSTER_ARCH ?= $(shell oc get nodes -o jsonpath='{.items[0].status.nodeInfo.architecture}') +CLUSTER_OS ?= $(shell oc get node -o jsonpath='{.items[0].status.nodeInfo.operatingSystem}') +DOCKER_BUILD_ARGS = --platform=$(CLUSTER_OS)/$(CLUSTER_ARCH) +GINKGO_ARGS ?= "" # by default (empty) run all tests, otherwise specify a test to run + # upstream ci target: verify-modules verify all test # we need to modify verify, test, all to avoid usage of docker CLI @@ -104,9 +110,33 @@ clean-oadp-operator: @echo "Cleaning oadp-operator" rm -rf $(OADP_E2E_DIR) -# to run just one test, use `make test-e2e GINKGO_ARGS="--ginkgo.focus='MySQL application CSI'"` +# build the Dockerfile.ubi +.PHONY: build +build: + @echo "Building Dockerfile.ubi with tag: $(LOCAL_BUILT_IMAGE)" + docker build -t $(LOCAL_BUILT_IMAGE) -f Dockerfile.ubi . $(DOCKER_BUILD_ARGS) + +# push the image to ttl.sh +.PHONY: push +push: + @echo "Pushing image: $(LOCAL_BUILT_IMAGE)" + docker push $(LOCAL_BUILT_IMAGE) + +# test-e2e is to be used by prow. .PHONY: test-e2e test-e2e: clone-oadp-operator @echo "Running oadp-operator e2e tests" pushd $(OADP_E2E_DIR) && export VELERO_IMAGE=$(VELERO_IMAGE) && make test-e2e && popd +# build and test locally +.PHONY: local-build-test-e2e +local-build-test-e2e: build push clone-oadp-operator + @echo "Building Velero and Running oadp-operator e2e tests locally" + pushd $(OADP_E2E_DIR) && export VELERO_IMAGE=$(LOCAL_BUILT_IMAGE) && export OPENSHIFT_CI=false && make test-e2e && popd + +# to run just one test, export GINKGO_ARGS="--ginkgo.focus='MySQL application CSI'" +# do NOT build, test locally +.PHONY: local-test-e2e +local-test-e2e: clone-oadp-operator + @echo "Running oadp-operator e2e tests locally" + pushd $(OADP_E2E_DIR) && export VELERO_IMAGE=$(LOCAL_BUILT_IMAGE) && export OPENSHIFT_CI=false && export GINKGO_ARGS=$(GINKGO_ARGS) && make test-e2e && popd \ No newline at end of file From ff05c64e479edb15fbfef55204d08731602fa920 Mon Sep 17 00:00:00 2001 From: Wesley Hayutin Date: Wed, 16 Oct 2024 13:14:39 -0600 Subject: [PATCH 05/10] add arch to name Signed-off-by: Wesley Hayutin --- Makefile.prow | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.prow b/Makefile.prow index a126bbfa77..1b61401f23 100644 --- a/Makefile.prow +++ b/Makefile.prow @@ -23,11 +23,12 @@ GOSRC := $(GOPATH)/src OADP_E2E_DIR := /tmp/oadp-operator OADP_E2E_BRANCH := master VELERO_IMAGE ?= quay.io/konveyor/velero:latest -LOCAL_BUILT_IMAGE=ttl.sh/velero-$(shell git rev-parse --short HEAD):1h CLUSTER_ARCH ?= $(shell oc get nodes -o jsonpath='{.items[0].status.nodeInfo.architecture}') CLUSTER_OS ?= $(shell oc get node -o jsonpath='{.items[0].status.nodeInfo.operatingSystem}') DOCKER_BUILD_ARGS = --platform=$(CLUSTER_OS)/$(CLUSTER_ARCH) GINKGO_ARGS ?= "" # by default (empty) run all tests, otherwise specify a test to run +LOCAL_BUILT_IMAGE=ttl.sh/velero-$(CLUSTER_ARCH)-$(shell git rev-parse --short HEAD):1h + # upstream ci target: verify-modules verify all test From b7709871721688d67c5e7cfc81f78ba8511998c8 Mon Sep 17 00:00:00 2001 From: Wesley Hayutin Date: Wed, 16 Oct 2024 14:19:42 -0600 Subject: [PATCH 06/10] remove duplicated clean/rm operator checkout --- Makefile.prow | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile.prow b/Makefile.prow index 1b61401f23..84cdc16ea4 100644 --- a/Makefile.prow +++ b/Makefile.prow @@ -101,9 +101,8 @@ $(GOBIN)/setup-envtest: go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest .PHONY: clone-oadp-operator -clone-oadp-operator: +clone-oadp-operator: clean-oadp-operator @echo "Cloning oadp-operator" - rm -rf $(OADP_E2E_DIR) git clone --depth 1 --single-branch --branch $(OADP_E2E_BRANCH) https://github.com/openshift/oadp-operator.git $(OADP_E2E_DIR) .PHONY: clean-oadp-operator From 7b7bc8d4e55ec6cc5b2978b3eb0de126db677f38 Mon Sep 17 00:00:00 2001 From: Wesley Hayutin <138787+weshayutin@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:41:55 -0600 Subject: [PATCH 07/10] simplify by dropping export var and use a oneliner Co-authored-by: Tiger Kaovilai --- Makefile.prow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.prow b/Makefile.prow index 84cdc16ea4..e553263ea9 100644 --- a/Makefile.prow +++ b/Makefile.prow @@ -126,7 +126,7 @@ push: .PHONY: test-e2e test-e2e: clone-oadp-operator @echo "Running oadp-operator e2e tests" - pushd $(OADP_E2E_DIR) && export VELERO_IMAGE=$(VELERO_IMAGE) && make test-e2e && popd + pushd $(OADP_E2E_DIR) && VELERO_IMAGE=$(VELERO_IMAGE) make test-e2e && popd # build and test locally .PHONY: local-build-test-e2e From 4ec125f65a255c84f9119c6731619cabd79b11c4 Mon Sep 17 00:00:00 2001 From: Wesley Hayutin <138787+weshayutin@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:42:27 -0600 Subject: [PATCH 08/10] drop export and use oneliner Co-authored-by: Tiger Kaovilai --- Makefile.prow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.prow b/Makefile.prow index e553263ea9..ee844c0d43 100644 --- a/Makefile.prow +++ b/Makefile.prow @@ -139,4 +139,4 @@ local-build-test-e2e: build push clone-oadp-operator .PHONY: local-test-e2e local-test-e2e: clone-oadp-operator @echo "Running oadp-operator e2e tests locally" - pushd $(OADP_E2E_DIR) && export VELERO_IMAGE=$(LOCAL_BUILT_IMAGE) && export OPENSHIFT_CI=false && export GINKGO_ARGS=$(GINKGO_ARGS) && make test-e2e && popd \ No newline at end of file + pushd $(OADP_E2E_DIR) && VELERO_IMAGE=$(LOCAL_BUILT_IMAGE) OPENSHIFT_CI=false GINKGO_ARGS=$(GINKGO_ARGS) make test-e2e && popd \ No newline at end of file From 13f16f2f4b6c75e20c9eea7421ae4ce426494074 Mon Sep 17 00:00:00 2001 From: Wesley Hayutin Date: Wed, 16 Oct 2024 15:11:02 -0600 Subject: [PATCH 09/10] just in case, allow oadp to be deployed from makefile Signed-off-by: Wesley Hayutin --- Makefile.prow | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile.prow b/Makefile.prow index ee844c0d43..fea7bdec36 100644 --- a/Makefile.prow +++ b/Makefile.prow @@ -122,6 +122,12 @@ push: @echo "Pushing image: $(LOCAL_BUILT_IMAGE)" docker push $(LOCAL_BUILT_IMAGE) +# deploy oadp-operator, potentially used by prow jobs +.PHONY: deploy-olm +deploy-olm: clone-oadp-operator + @echo "Deploying oadp-operator" + pushd $(OADP_E2E_DIR) && make deploy-olm && popd + # test-e2e is to be used by prow. .PHONY: test-e2e test-e2e: clone-oadp-operator From 8052398d83d8c3714820f4cc33ab3734e7343742 Mon Sep 17 00:00:00 2001 From: Wesley Hayutin <138787+weshayutin@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:30:19 -0600 Subject: [PATCH 10/10] Update Makefile.prow Co-authored-by: Tiger Kaovilai --- Makefile.prow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.prow b/Makefile.prow index fea7bdec36..88aa9d5715 100644 --- a/Makefile.prow +++ b/Makefile.prow @@ -138,7 +138,7 @@ test-e2e: clone-oadp-operator .PHONY: local-build-test-e2e local-build-test-e2e: build push clone-oadp-operator @echo "Building Velero and Running oadp-operator e2e tests locally" - pushd $(OADP_E2E_DIR) && export VELERO_IMAGE=$(LOCAL_BUILT_IMAGE) && export OPENSHIFT_CI=false && make test-e2e && popd + pushd $(OADP_E2E_DIR) && VELERO_IMAGE=$(LOCAL_BUILT_IMAGE) OPENSHIFT_CI=false make test-e2e && popd # to run just one test, export GINKGO_ARGS="--ginkgo.focus='MySQL application CSI'" # do NOT build, test locally