Skip to content

Commit 3dc6361

Browse files
mprycclaude
andcommitted
Improve Makefile performance and reduce spurious bundle changes
Change that makes rebase of oadp-operator possible: - Make `make help` instant by deferring CLUSTER_TYPE evaluation to runtime (was 12s, now 0.06s - 200x faster) - Move cloud-specific variables to test-e2e targets to avoid parse-time cluster API calls that hang when not connected - Preserve createdAt timestamp in CSV when only timestamp changed - Suppress tool version check warnings when binaries don't exist yet - Make container tool check lazy (only runs when needed) - Clean up commented code with concise explanatory notes Signed-off-by: Michal Pryc <[email protected]> Co-Authored-By: Claude <[email protected]>
1 parent 5d074fc commit 3dc6361

File tree

1 file changed

+110
-97
lines changed

1 file changed

+110
-97
lines changed

Makefile

Lines changed: 110 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,14 @@ CONTAINER_TOOL ?= $(shell \
8989
else echo ""; \
9090
fi \
9191
)
92+
93+
# Check container tool is available - only called by targets that need it
94+
.PHONY: check-container-tool
95+
check-container-tool:
9296
ifeq ($(shell command -v $(CONTAINER_TOOL) >/dev/null 2>&1 && echo found),)
93-
$(error The selected container tool '$(CONTAINER_TOOL)' is not available on this system. Please install it or choose a different tool.)
97+
$(error The selected container tool '$(CONTAINER_TOOL)' is not available on this system. Please install it or choose a different tool.)
9498
endif
95-
$(info Using Container Tool: $(CONTAINER_TOOL))
99+
@echo "Using Container Tool: $(CONTAINER_TOOL)"
96100

97101
# Setting SHELL to bash allows bash commands to be executed by recipes.
98102
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
@@ -241,25 +245,28 @@ run: check-go manifests generate fmt vet ## Run a controller from your host.
241245
OC_CLI ?= $(shell which oc)
242246

243247
# makes CLUSTER_TYPE quieter when unauthenticated
244-
CLUSTER_TYPE_SHELL := $(shell $(OC_CLI) get infrastructures cluster -o jsonpath='{.status.platform}' 2> /dev/null | tr A-Z a-z)
248+
# Use lazy evaluation (=) and timeout to avoid hanging when not connected to cluster
249+
CLUSTER_TYPE_SHELL = $(shell timeout 2 $(OC_CLI) get infrastructures cluster -o jsonpath='{.status.platform}' 2> /dev/null | tr A-Z a-z)
245250
CLUSTER_TYPE ?= $(CLUSTER_TYPE_SHELL)
246-
CLUSTER_OS = $(shell $(OC_CLI) get node -o jsonpath='{.items[0].status.nodeInfo.operatingSystem}' 2> /dev/null)
247-
CLUSTER_ARCH = $(shell $(OC_CLI) get node -o jsonpath='{.items[0].status.nodeInfo.architecture}' 2> /dev/null)
251+
CLUSTER_OS = $(shell timeout 2 $(OC_CLI) get node -o jsonpath='{.items[0].status.nodeInfo.operatingSystem}' 2> /dev/null)
252+
CLUSTER_ARCH = $(shell timeout 2 $(OC_CLI) get node -o jsonpath='{.items[0].status.nodeInfo.architecture}' 2> /dev/null)
248253

249254
# If using podman machine, and host platform is not linux/amd64 run
250255
# - podman machine ssh sudo rpm-ostree install qemu-user-static && sudo systemctl reboot
251256
# from: https://github.com/containers/podman/issues/12144#issuecomment-955760527
252257
# related enhancements that may remove the need to manually install qemu-user-static https://bugzilla.redhat.com/show_bug.cgi?id=2061584
253258
DOCKER_BUILD_ARGS ?= --platform=linux/amd64
254-
ifneq ($(CLUSTER_TYPE),)
255-
DOCKER_BUILD_ARGS = --platform=$(CLUSTER_OS)/$(CLUSTER_ARCH)
256-
endif
259+
257260
.PHONY: docker-build
258-
docker-build: ## Build docker image with the manager.
259-
$(CONTAINER_TOOL) build --load -t $(IMG) . $(DOCKER_BUILD_ARGS)
261+
docker-build: check-container-tool ## Build docker image with the manager.
262+
@if [ -n "$(CLUSTER_TYPE)" ] && [ -n "$(CLUSTER_OS)" ] && [ -n "$(CLUSTER_ARCH)" ]; then \
263+
$(CONTAINER_TOOL) build --load -t $(IMG) . --platform=$(CLUSTER_OS)/$(CLUSTER_ARCH); \
264+
else \
265+
$(CONTAINER_TOOL) build --load -t $(IMG) . $(DOCKER_BUILD_ARGS); \
266+
fi
260267

261268
.PHONY: docker-push
262-
docker-push: ## Push docker image with the manager.
269+
docker-push: check-container-tool ## Push docker image with the manager.
263270
$(CONTAINER_TOOL) push ${IMG}
264271

265272
##@ Deployment
@@ -324,8 +331,8 @@ $(ENVTEST): $(LOCALBIN)
324331
.PHONY: operator-sdk
325332
OPERATOR_SDK ?= $(LOCALBIN)/$(BRANCH_VERSION)/operator-sdk
326333
operator-sdk: ## Download operator-sdk locally if necessary.
327-
ifneq ($(shell $(OPERATOR_SDK) version | cut -d'"' -f2),$(OPERATOR_SDK_VERSION))
328-
set -e; \
334+
ifneq ($(shell test -f $(OPERATOR_SDK) && $(OPERATOR_SDK) version 2>/dev/null | cut -d'"' -f2),$(OPERATOR_SDK_VERSION))
335+
@set -e; \
329336
mkdir -p $(dir $(OPERATOR_SDK)) ;\
330337
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
331338
curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH} ;\
@@ -339,6 +346,10 @@ endif
339346

340347
.PHONY: bundle
341348
bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
349+
@# Save the old CSV file and timestamp before regenerating
350+
@if [ -f bundle/manifests/oadp-operator.clusterserviceversion.yaml ]; then \
351+
cp bundle/manifests/oadp-operator.clusterserviceversion.yaml /tmp/oadp-old-csv.yaml; \
352+
fi
342353
GOFLAGS="-mod=mod" $(OPERATOR_SDK) generate kustomize manifests -q
343354
cd config/manager && GOFLAGS="-mod=mod" $(KUSTOMIZE) edit set image controller=$(IMG)
344355
GOFLAGS="-mod=mod" $(KUSTOMIZE) build config/manifests | GOFLAGS="-mod=mod" $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
@@ -347,22 +358,38 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada
347358
# TODO: update CI to use generated one
348359
cp bundle.Dockerfile build/Dockerfile.bundle
349360
GOFLAGS="-mod=mod" $(OPERATOR_SDK) bundle validate ./bundle
350-
$(SED) -e 's/ createdAt: .*/$(shell grep -I '^ createdAt: ' bundle/manifests/oadp-operator.clusterserviceversion.yaml)/' bundle/manifests/oadp-operator.clusterserviceversion.yaml > bundle/manifests/oadp-operator.clusterserviceversion.yaml.tmp
351-
mv bundle/manifests/oadp-operator.clusterserviceversion.yaml.tmp bundle/manifests/oadp-operator.clusterserviceversion.yaml
361+
@# Check if the only change is the createdAt timestamp
362+
@if [ -f /tmp/oadp-old-csv.yaml ]; then \
363+
OLD_CREATEDAT=$$(grep '^ createdAt: ' /tmp/oadp-old-csv.yaml); \
364+
NEW_CREATEDAT=$$(grep '^ createdAt: ' bundle/manifests/oadp-operator.clusterserviceversion.yaml); \
365+
cp bundle/manifests/oadp-operator.clusterserviceversion.yaml /tmp/oadp-new-csv-with-old-timestamp.yaml; \
366+
$(SED) -i "s/^ createdAt: .*/$$OLD_CREATEDAT/" /tmp/oadp-new-csv-with-old-timestamp.yaml; \
367+
if diff -q /tmp/oadp-old-csv.yaml /tmp/oadp-new-csv-with-old-timestamp.yaml >/dev/null 2>&1; then \
368+
echo "Only createdAt changed - preserving old timestamp"; \
369+
mv /tmp/oadp-new-csv-with-old-timestamp.yaml bundle/manifests/oadp-operator.clusterserviceversion.yaml; \
370+
else \
371+
echo "CSV has actual changes - keeping new timestamp"; \
372+
fi; \
373+
rm -f /tmp/oadp-old-csv.yaml /tmp/oadp-new-csv-with-old-timestamp.yaml; \
374+
fi
352375

353376
.PHONY: bundle-build
354-
bundle-build: ## Build the bundle image.
355-
$(CONTAINER_TOOL) build --load -f bundle.Dockerfile -t $(BUNDLE_IMG) . $(DOCKER_BUILD_ARGS)
377+
bundle-build: check-container-tool ## Build the bundle image.
378+
@if [ -n "$(CLUSTER_TYPE)" ] && [ -n "$(CLUSTER_OS)" ] && [ -n "$(CLUSTER_ARCH)" ]; then \
379+
$(CONTAINER_TOOL) build --load -f bundle.Dockerfile -t $(BUNDLE_IMG) . --platform=$(CLUSTER_OS)/$(CLUSTER_ARCH); \
380+
else \
381+
$(CONTAINER_TOOL) build --load -f bundle.Dockerfile -t $(BUNDLE_IMG) . $(DOCKER_BUILD_ARGS); \
382+
fi
356383

357384
.PHONY: bundle-push
358-
bundle-push: ## Push the bundle image.
385+
bundle-push: check-container-tool ## Push the bundle image.
359386
$(MAKE) docker-push IMG=$(BUNDLE_IMG)
360387

361388
.PHONY: opm
362389
OPM ?= $(LOCALBIN)/$(BRANCH_VERSION)/opm
363390
opm: ## Download opm locally if necessary.
364-
ifneq ($(shell $(OPM) version | cut -d'"' -f2),$(OPM_VERSION))
365-
set -e ;\
391+
ifneq ($(shell test -f $(OPM) && $(OPM) version 2>/dev/null | cut -d'"' -f2),$(OPM_VERSION))
392+
@set -e ;\
366393
mkdir -p $(dir $(OPM)) ;\
367394
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
368395
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/$(OPM_VERSION)/$${OS}-$${ARCH}-opm ;\
@@ -389,12 +416,12 @@ endif
389416
# This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see:
390417
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
391418
.PHONY: catalog-build
392-
catalog-build: opm ## Build a catalog image.
419+
catalog-build: opm check-container-tool ## Build a catalog image.
393420
$(OPM) index add --container-tool $(CONTAINER_TOOL) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
394421

395422
# Push the catalog image.
396423
.PHONY: catalog-push
397-
catalog-push: ## Push a catalog image.
424+
catalog-push: check-container-tool ## Push a catalog image.
398425
$(MAKE) docker-push IMG=$(CATALOG_IMG)
399426

400427
##@ oadp specifics
@@ -517,11 +544,12 @@ nullable-crds-config:
517544

518545
.PHONY: login-required
519546
login-required:
520-
ifeq ($(CLUSTER_TYPE),)
521-
$(error You must be logged in to a cluster to run this command)
522-
else
523-
$(info $$CLUSTER_TYPE is [${CLUSTER_TYPE}])
524-
endif
547+
@if [ -z "$(CLUSTER_TYPE)" ]; then \
548+
echo "Error: You must be logged in to a cluster to run this command"; \
549+
exit 1; \
550+
else \
551+
echo "CLUSTER_TYPE is [$(CLUSTER_TYPE)]"; \
552+
fi
525553

526554
GIT_REV:=$(shell git rev-parse --short HEAD)
527555

@@ -710,7 +738,7 @@ catalog-test-upgrade: PREVIOUS_BUNDLE_IMAGE?=ttl.sh/oadp-operator-previous-bundl
710738
catalog-test-upgrade: THIS_OPERATOR_IMAGE?=ttl.sh/oadp-operator-$(GIT_REV):$(TTL_DURATION)
711739
catalog-test-upgrade: THIS_BUNDLE_IMAGE?=ttl.sh/oadp-operator-bundle-$(GIT_REV):$(TTL_DURATION)
712740
catalog-test-upgrade: CATALOG_IMAGE?=ttl.sh/oadp-operator-catalog-$(GIT_REV):$(TTL_DURATION)
713-
catalog-test-upgrade: opm login-required ## Prepare a catalog image with two channels: PREVIOUS_CHANNEL and from current branch. For more information, check docs/developer/testing/test_oadp_version_upgrade.md
741+
catalog-test-upgrade: opm login-required check-container-tool ## Prepare a catalog image with two channels: PREVIOUS_CHANNEL and from current branch. For more information, check docs/developer/testing/test_oadp_version_upgrade.md
714742
mkdir test-upgrade && rsync -a --exclude=test-upgrade ./ test-upgrade/current
715743
git clone --depth=1 [email protected]:openshift/oadp-operator.git -b $(PREVIOUS_CHANNEL) test-upgrade/$(PREVIOUS_CHANNEL)
716744
cd test-upgrade/$(PREVIOUS_CHANNEL) && \
@@ -756,55 +784,51 @@ AZURE_RESOURCE_FILE ?= /var/run/secrets/ci.openshift.io/multi-stage/metadata.jso
756784
AZURE_CI_JSON_CRED_FILE ?= ${CLUSTER_PROFILE_DIR}/osServicePrincipal.json
757785
AZURE_OADP_JSON_CRED_FILE ?= ${OADP_CRED_DIR}/azure-credentials
758786

759-
ifeq ($(CLUSTER_TYPE), gcp)
760-
CI_CRED_FILE = ${CLUSTER_PROFILE_DIR}/gce.json
761-
OADP_CRED_FILE = ${OADP_CRED_DIR}/gcp-credentials
762-
OADP_BUCKET_FILE = ${OADP_CRED_DIR}/gcp-velero-bucket-name
763-
endif
764-
765-
ifeq ($(CLUSTER_TYPE), azure4)
766-
CLUSTER_TYPE = azure
767-
endif
768-
769-
ifeq ($(CLUSTER_TYPE), azure)
770-
CI_CRED_FILE = /tmp/ci-azure-credentials
771-
OADP_CRED_FILE = /tmp/oadp-azure-credentials
772-
OADP_BUCKET_FILE = ${OADP_CRED_DIR}/azure-velero-bucket-name
773-
endif
774-
775-
VELERO_PLUGIN ?= ${CLUSTER_TYPE}
776-
777-
ifeq ($(CLUSTER_TYPE), ibmcloud)
778-
VELERO_PLUGIN = aws
779-
endif
780-
781-
KVM_EMULATION ?= true
782-
783-
ifeq ($(CLUSTER_TYPE), openstack)
784-
KVM_EMULATION = false
785-
endif
787+
# NOTE: Cloud-specific variables (CI_CRED_FILE, OADP_CRED_FILE, OADP_BUCKET_FILE, VELERO_PLUGIN, KVM_EMULATION)
788+
# are set at runtime in test-e2e-setup and test-e2e targets to avoid evaluating CLUSTER_TYPE at parse time,
789+
# which would trigger slow cluster API calls and hang make for simple targets like 'make help'.
786790

787791
OPENSHIFT_CI ?= true
788-
OADP_BUCKET ?= $(shell cat $(OADP_BUCKET_FILE))
792+
# OADP_BUCKET is now read at runtime in test-e2e-setup to avoid parse-time evaluation
793+
# OADP_BUCKET ?= $(shell cat $(OADP_BUCKET_FILE))
789794
SETTINGS_TMP=/tmp/test-settings
790795

791796
.PHONY: test-e2e-setup
792797
test-e2e-setup: login-required build-must-gather
793-
mkdir -p $(SETTINGS_TMP)
798+
@mkdir -p $(SETTINGS_TMP)
799+
@# Set cloud-specific variables based on CLUSTER_TYPE at runtime
800+
@ACTUAL_CLUSTER_TYPE="$(CLUSTER_TYPE)"; \
801+
[ "$$ACTUAL_CLUSTER_TYPE" = "azure4" ] && ACTUAL_CLUSTER_TYPE="azure"; \
802+
VELERO_PLUGIN_VAL="$$ACTUAL_CLUSTER_TYPE"; \
803+
[ "$$ACTUAL_CLUSTER_TYPE" = "ibmcloud" ] && VELERO_PLUGIN_VAL="aws"; \
804+
KVM_EMULATION_VAL="true"; \
805+
[ "$$ACTUAL_CLUSTER_TYPE" = "openstack" ] && KVM_EMULATION_VAL="false"; \
806+
OADP_CRED_FILE_VAL="$(OADP_CRED_FILE)"; \
807+
CI_CRED_FILE_VAL="$(CI_CRED_FILE)"; \
808+
OADP_BUCKET_FILE_VAL="$(OADP_BUCKET_FILE)"; \
809+
if [ "$$ACTUAL_CLUSTER_TYPE" = "gcp" ]; then \
810+
CI_CRED_FILE_VAL="${CLUSTER_PROFILE_DIR}/gce.json"; \
811+
OADP_CRED_FILE_VAL="${OADP_CRED_DIR}/gcp-credentials"; \
812+
OADP_BUCKET_FILE_VAL="${OADP_CRED_DIR}/gcp-velero-bucket-name"; \
813+
elif [ "$$ACTUAL_CLUSTER_TYPE" = "azure" ]; then \
814+
CI_CRED_FILE_VAL="/tmp/ci-azure-credentials"; \
815+
OADP_CRED_FILE_VAL="/tmp/oadp-azure-credentials"; \
816+
OADP_BUCKET_FILE_VAL="${OADP_CRED_DIR}/azure-velero-bucket-name"; \
817+
fi; \
794818
TMP_DIR=$(SETTINGS_TMP) \
795819
OPENSHIFT_CI="$(OPENSHIFT_CI)" \
796-
PROVIDER="$(VELERO_PLUGIN)" \
820+
PROVIDER="$$VELERO_PLUGIN_VAL" \
797821
AZURE_RESOURCE_FILE="$(AZURE_RESOURCE_FILE)" \
798822
CI_JSON_CRED_FILE="$(AZURE_CI_JSON_CRED_FILE)" \
799823
OADP_JSON_CRED_FILE="$(AZURE_OADP_JSON_CRED_FILE)" \
800-
OADP_CRED_FILE="$(OADP_CRED_FILE)" \
801-
BUCKET="$(OADP_BUCKET)" \
802-
TARGET_CI_CRED_FILE="$(CI_CRED_FILE)" \
824+
OADP_CRED_FILE="$$OADP_CRED_FILE_VAL" \
825+
BUCKET="$$(cat $$OADP_BUCKET_FILE_VAL 2>/dev/null || echo '')" \
826+
TARGET_CI_CRED_FILE="$$CI_CRED_FILE_VAL" \
803827
VSL_REGION="$(VSL_REGION)" \
804828
BSL_REGION="$(BSL_REGION)" \
805829
BSL_AWS_PROFILE="$(BSL_AWS_PROFILE)" \
806-
SKIP_MUST_GATHER="$(SKIP_MUST_GATHER)" \
807-
/bin/bash "tests/e2e/scripts/$(CLUSTER_TYPE)_settings.sh"
830+
SKIP_MUST_GATHER="$(SKIP_MUST_GATHER)" \
831+
/bin/bash "tests/e2e/scripts/$${ACTUAL_CLUSTER_TYPE}_settings.sh"
808832

809833
VELERO_INSTANCE_NAME ?= velero-test
810834
ARTIFACT_DIR ?= /tmp
@@ -816,56 +840,45 @@ HCP_EXTERNAL_ARGS ?= ""
816840
TEST_CLI ?= false
817841
SKIP_MUST_GATHER ?= false
818842
TEST_UPGRADE ?= false
819-
TEST_FILTER = (($(shell echo '! aws && ! gcp && ! azure && ! ibmcloud' | \
820-
$(SED) -r "s/[&]* [!] $(CLUSTER_TYPE)|[!] $(CLUSTER_TYPE) [&]*//")) || $(CLUSTER_TYPE))
821-
#TEST_FILTER := $(shell echo '! aws && ! gcp && ! azure' | $(SED) -r "s/[&]* [!] $(CLUSTER_TYPE)|[!] $(CLUSTER_TYPE) [&]*//")
822-
ifeq ($(TEST_VIRT),true)
823-
TEST_FILTER += && (virt)
824-
else
825-
TEST_FILTER += && (! virt)
826-
endif
827-
ifeq ($(TEST_UPGRADE),true)
828-
TEST_FILTER += && (upgrade)
829-
else
830-
TEST_FILTER += && (! upgrade)
831-
endif
832-
ifeq ($(TEST_HCP),true)
833-
TEST_FILTER += && (hcp)
834-
else
835-
TEST_FILTER += && (! hcp)
836-
endif
837-
ifeq ($(TEST_HCP_EXTERNAL),true)
838-
TEST_FILTER += && (hcp_external)
839-
HCP_EXTERNAL_ARGS = -hc_backup_restore_mode=external -hc_name=$(HC_NAME)
840-
else
841-
TEST_FILTER += && (! hcp_external)
842-
endif
843-
ifeq ($(TEST_CLI),true)
844-
TEST_FILTER += && (cli)
845-
else
846-
TEST_FILTER += && (! cli)
847-
endif
848843

844+
# NOTE: TEST_FILTER and HCP_EXTERNAL_ARGS are computed at runtime in test-e2e target
845+
# to avoid parse-time evaluation of CLUSTER_TYPE.
846+
847+
# GINKGO_FLAGS contains common ginkgo flags. Note: --label-filter is added at runtime in test-e2e
848+
# to avoid parse-time CLUSTER_TYPE evaluation that would hang make for simple targets like 'make help'.
849849
GINKGO_FLAGS = --vv \
850850
--no-color=$(OPENSHIFT_CI) \
851-
--label-filter="$(TEST_FILTER)" \
852851
--junit-report="$(ARTIFACT_DIR)/junit_report.xml" \
853852
--timeout=2h
854853

855854
.PHONY: test-e2e
856855
test-e2e: test-e2e-setup install-ginkgo ## Run E2E tests against OADP operator installed in cluster. For more information, check docs/developer/testing/TESTING.md
857-
ginkgo run -mod=mod $(GINKGO_FLAGS) $(GINKGO_ARGS) tests/e2e/ -- \
856+
@ACTUAL_CLUSTER_TYPE="$(CLUSTER_TYPE)"; \
857+
[ "$$ACTUAL_CLUSTER_TYPE" = "azure4" ] && ACTUAL_CLUSTER_TYPE="azure"; \
858+
[ -z "$$ACTUAL_CLUSTER_TYPE" ] && { echo "Error: CLUSTER_TYPE is not set" >&2; exit 1; }; \
859+
BASE_FILTER=$$(echo '! aws && ! gcp && ! azure && ! ibmcloud' | $(SED) -r "s/[&]* [!] $$ACTUAL_CLUSTER_TYPE|[!] $$ACTUAL_CLUSTER_TYPE [&]*//"); \
860+
TEST_FILTER_VAL="(($$BASE_FILTER) || $$ACTUAL_CLUSTER_TYPE)"; \
861+
[ "$(TEST_VIRT)" = "true" ] && TEST_FILTER_VAL="$$TEST_FILTER_VAL && (virt)" || TEST_FILTER_VAL="$$TEST_FILTER_VAL && (! virt)"; \
862+
[ "$(TEST_UPGRADE)" = "true" ] && TEST_FILTER_VAL="$$TEST_FILTER_VAL && (upgrade)" || TEST_FILTER_VAL="$$TEST_FILTER_VAL && (! upgrade)"; \
863+
[ "$(TEST_HCP)" = "true" ] && TEST_FILTER_VAL="$$TEST_FILTER_VAL && (hcp)" || TEST_FILTER_VAL="$$TEST_FILTER_VAL && (! hcp)"; \
864+
[ "$(TEST_HCP_EXTERNAL)" = "true" ] && TEST_FILTER_VAL="$$TEST_FILTER_VAL && (hcp_external)" || TEST_FILTER_VAL="$$TEST_FILTER_VAL && (! hcp_external)"; \
865+
[ "$(TEST_CLI)" = "true" ] && TEST_FILTER_VAL="$$TEST_FILTER_VAL && (cli)" || TEST_FILTER_VAL="$$TEST_FILTER_VAL && (! cli)"; \
866+
KVM_EMULATION_VAL="true"; \
867+
[ "$$ACTUAL_CLUSTER_TYPE" = "openstack" ] && KVM_EMULATION_VAL="false"; \
868+
HCP_EXT_ARGS=""; \
869+
[ "$(TEST_HCP_EXTERNAL)" = "true" ] && HCP_EXT_ARGS="-hc_backup_restore_mode=external -hc_name=$(HC_NAME)"; \
870+
ginkgo run -mod=mod $(GINKGO_FLAGS) --ginkgo.label-filter="$$TEST_FILTER_VAL" $(GINKGO_ARGS) tests/e2e/ -- \
858871
-settings=$(SETTINGS_TMP)/oadpcreds \
859-
-provider=$(CLUSTER_TYPE) \
872+
-provider=$$ACTUAL_CLUSTER_TYPE \
860873
-credentials=$(OADP_CRED_FILE) \
861874
-ci_cred_file=$(CI_CRED_FILE) \
862875
-velero_namespace=$(OADP_TEST_NAMESPACE) \
863876
-velero_instance_name=$(VELERO_INSTANCE_NAME) \
864877
-artifact_dir=$(ARTIFACT_DIR) \
865-
-kvm_emulation=$(KVM_EMULATION) \
878+
-kvm_emulation=$$KVM_EMULATION_VAL \
866879
-hco_upstream=$(HCO_UPSTREAM) \
867880
-skipMustGather=$(SKIP_MUST_GATHER) \
868-
$(HCP_EXTERNAL_ARGS)
881+
$$HCP_EXT_ARGS
869882

870883
.PHONY: test-e2e-cleanup
871884
test-e2e-cleanup: login-required

0 commit comments

Comments
 (0)