From 7cb60ccf05882814122dd8e98c23bb9e3e06bd6f Mon Sep 17 00:00:00 2001 From: Tiger Kaovilai Date: Thu, 5 May 2022 23:56:01 -0400 Subject: [PATCH 1/4] deploy-olm make target uses tmp to avoid modifying repo --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b57cff674c..002731ec47 100644 --- a/Makefile +++ b/Makefile @@ -294,12 +294,17 @@ bundle-push: ## Push the bundle image. deploy-olm: GIT_REV=$(shell git rev-parse --short HEAD) deploy-olm: THIS_OPERATOR_IMAGE?=ttl.sh/oadp-operator-$(GIT_REV):1h # Set target specific variable deploy-olm: THIS_BUNDLE_IMAGE?=ttl.sh/oadp-operator-bundle-$(GIT_REV):1h # Set target specific variable +deploy-olm: DEPLOY_TMP?=/tmp/oadp-deploy-olm/ # Set target specific variable deploy-olm: oc whoami # Check if logged in oc create namespace $(OADP_TEST_NAMESPACE) # This should error out if namespace already exists, delete namespace (to clear current resources) before proceeding + mkdir -p $(DEPLOY_TMP) + cp -r . $(DEPLOY_TMP) + cd $(DEPLOY_TMP) && \ IMG=$(THIS_OPERATOR_IMAGE) BUNDLE_IMG=$(THIS_BUNDLE_IMAGE) \ - make docker-build docker-push bundle bundle-build bundle-push # build and push operator and bundle image + make docker-build docker-push bundle bundle-build bundle-push && \ # build and push operator and bundle image operator-sdk run bundle $(THIS_BUNDLE_IMAGE) --namespace $(OADP_TEST_NAMESPACE) # use operator-sdk to install bundle to authenticated cluster + rm -rf $(DEPLOY_TMP) .PHONY: opm OPM = ./bin/opm From 50d549a59538733833fe06840f05ff97a4d75166 Mon Sep 17 00:00:00 2001 From: Tiger Kaovilai Date: Fri, 6 May 2022 01:14:55 -0400 Subject: [PATCH 2/4] rm before mkdir, move comments away from commands. --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 002731ec47..8a399915d6 100644 --- a/Makefile +++ b/Makefile @@ -298,12 +298,15 @@ deploy-olm: DEPLOY_TMP?=/tmp/oadp-deploy-olm/ # Set target specific variable deploy-olm: oc whoami # Check if logged in oc create namespace $(OADP_TEST_NAMESPACE) # This should error out if namespace already exists, delete namespace (to clear current resources) before proceeding + rm -rf $(DEPLOY_TMP) mkdir -p $(DEPLOY_TMP) cp -r . $(DEPLOY_TMP) + # build and push operator and bundle image + # use operator-sdk to install bundle to authenticated cluster cd $(DEPLOY_TMP) && \ IMG=$(THIS_OPERATOR_IMAGE) BUNDLE_IMG=$(THIS_BUNDLE_IMAGE) \ - make docker-build docker-push bundle bundle-build bundle-push && \ # build and push operator and bundle image - operator-sdk run bundle $(THIS_BUNDLE_IMAGE) --namespace $(OADP_TEST_NAMESPACE) # use operator-sdk to install bundle to authenticated cluster + make docker-build docker-push bundle bundle-build bundle-push && \ + operator-sdk run bundle $(THIS_BUNDLE_IMAGE) --namespace $(OADP_TEST_NAMESPACE) ; \ rm -rf $(DEPLOY_TMP) .PHONY: opm From 53717a3680696b9cf242eca243aa95bab517a0f2 Mon Sep 17 00:00:00 2001 From: Tiger Kaovilai Date: Fri, 6 May 2022 22:32:53 -0400 Subject: [PATCH 3/4] Use expanded variable DEPLOY_TMP --- Makefile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 8a399915d6..46165d84cc 100644 --- a/Makefile +++ b/Makefile @@ -291,23 +291,22 @@ bundle-push: ## Push the bundle image. $(MAKE) docker-push IMG=$(BUNDLE_IMG) ## Build current branch operator image, bundle image, push and install via OLM +.PHONY: deploy-olm deploy-olm: GIT_REV=$(shell git rev-parse --short HEAD) deploy-olm: THIS_OPERATOR_IMAGE?=ttl.sh/oadp-operator-$(GIT_REV):1h # Set target specific variable deploy-olm: THIS_BUNDLE_IMAGE?=ttl.sh/oadp-operator-bundle-$(GIT_REV):1h # Set target specific variable -deploy-olm: DEPLOY_TMP?=/tmp/oadp-deploy-olm/ # Set target specific variable +deploy-olm: DEPLOY_TMP:=$(shell mktemp -d)/ # Set target specific variable deploy-olm: oc whoami # Check if logged in oc create namespace $(OADP_TEST_NAMESPACE) # This should error out if namespace already exists, delete namespace (to clear current resources) before proceeding - rm -rf $(DEPLOY_TMP) - mkdir -p $(DEPLOY_TMP) - cp -r . $(DEPLOY_TMP) + @echo "DEPLOY_TMP: $(DEPLOY_TMP)" # build and push operator and bundle image # use operator-sdk to install bundle to authenticated cluster - cd $(DEPLOY_TMP) && \ + cp -r . $(DEPLOY_TMP) && cd $(DEPLOY_TMP) && \ IMG=$(THIS_OPERATOR_IMAGE) BUNDLE_IMG=$(THIS_BUNDLE_IMAGE) \ - make docker-build docker-push bundle bundle-build bundle-push && \ - operator-sdk run bundle $(THIS_BUNDLE_IMAGE) --namespace $(OADP_TEST_NAMESPACE) ; \ + make docker-build docker-push bundle bundle-build bundle-push; \ rm -rf $(DEPLOY_TMP) + operator-sdk run bundle $(THIS_BUNDLE_IMAGE) --namespace $(OADP_TEST_NAMESPACE) .PHONY: opm OPM = ./bin/opm From 480fb985fe5e7a0a8cebc6194f6427b60256ac0e Mon Sep 17 00:00:00 2001 From: Tiger Kaovilai Date: Fri, 6 May 2022 22:40:25 -0400 Subject: [PATCH 4/4] add cache to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b973e853e0..f2a1df250b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ tests/e2e/e2e.test cover.out .DS_Store tests/e2e/templates/*.yaml +cache/ # `operator-sdk run bundle` caches files in this directory