Skip to content

Commit

Permalink
Run uptest with the relevant family resource providers
Browse files Browse the repository at this point in the history
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
  • Loading branch information
ulucinar committed Oct 2, 2023
1 parent 4431a44 commit e4e036f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 17 deletions.
40 changes: 33 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,20 @@ uptest-local:
@$(WARN) "this target is deprecated, please use 'make uptest' instead"

build.%:
@$(MAKE) build SUBPACKAGES=$* LOAD_PACKAGES=true
@$(MAKE) build SUBPACKAGES="$$(tr ',' ' ' <<< $*)" LOAD_PACKAGES=true

XPKG_SKIP_DEP_RESOLUTION := true

local-deploy.%: controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME)-%
@$(INFO) running locally built provider
$(KUBECTL) wait provider.pkg $(PROJECT_NAME)-$* --for condition=Healthy --timeout 5m
@$(KUBECTL) -n upbound-system wait --for=condition=Available deployment --all --timeout=5m
@$(OK) running locally built provider
local-deploy.%: controlplane.up
@for api in $$(tr ',' ' ' <<< $*); do \
$(MAKE) local.xpkg.deploy.provider.$(PROJECT_NAME)-$${api}; \
$(INFO) running locally built $(PROJECT_NAME)-$${api}; \
$(KUBECTL) wait provider.pkg $(PROJECT_NAME)-$${api} --for condition=Healthy --timeout 5m; \
$(KUBECTL) -n upbound-system wait --for=condition=Available deployment --all --timeout=5m; \
$(OK) running locally built $(PROJECT_NAME)-$${api}; \
done || $(FAIL)

local-deploy: build.monolith local-deploy.monolith

# This target requires the following environment variables to be set:
# - UPTEST_CLOUD_CREDENTIALS, cloud credentials for the provider being tested, e.g.
Expand All @@ -211,7 +216,28 @@ local-deploy.%: controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME)-%
# $ export UPTEST_CLOUD_CREDENTIALS=$(echo "DEFAULT='$(cat ~/.aws/credentials)'\nPEER='$(cat ~/.aws/credentials-uptest)'")
# - UPTEST_EXAMPLE_LIST, a comma-separated list of examples to test
# - UPTEST_DATASOURCE_PATH, see https://github.com/upbound/uptest#injecting-dynamic-values-and-datasource
e2e: local-deploy uptest

# @$(MAKE) build.config local-deploy.config
# $(MAKE) build.$${api} local-deploy.$${api};
family-e2e:
@(INSTALL_APIS=""; \
for m in $$(tr ',' ' ' <<< $${UPTEST_EXAMPLE_LIST}); do \
$(INFO) Processing the example manifest "$${m}"; \
for api in $$(sed -nE 's/^apiVersion: *(.+)/\1/p' "$${m}" | cut -d. -f1); do \
if [[ $${INSTALL_APIS} =~ " $${api} " ]]; then \
$(INFO) Resource provider $(PROJECT_NAME)-$${api} is already installed. Skipping...; \
continue; \
fi; \
$(INFO) Installing the family resource $(PROJECT_NAME)-$${api} for the test file: $${m}; \
INSTALL_APIS="$${INSTALL_APIS} $${api} "; \
done; \
done; \
INSTALL_APIS="config,$$(tr -s ' ' ',' <<< $${INSTALL_APIS})"; \
$(INFO) Building and deploying resource providers for the short API groups: $${INSTALL_APIS}; \
$(MAKE) build.$${INSTALL_APIS} local-deploy.$${INSTALL_APIS}) || $(FAIL)
$(MAKE) uptest

e2e: family-e2e

# TODO: please move this to the common build submodule
# once the use cases mature
Expand Down
2 changes: 1 addition & 1 deletion build
Submodule build updated 1 files
+3 −2 makelib/local.xpkg.mk
20 changes: 11 additions & 9 deletions cluster/images/provider-aws/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ img.build:
@$(INFO) Building image $${IMAGE}; \
$(MAKE) BUILD_ARGS="--load ${BUILD_ARGS}" IMAGE=$${IMAGE} XPKG_REG_ORGS=$(XPKG_REG_ORGS) img.build.shared; \
if [[ "$${LOAD_PACKAGES}" == "true" ]]; then \
$(MAKE) batch-process SUBPACKAGES=$(SUBPACKAGES) BATCH_PLATFORMS=$(PLATFORM) BUILD_ONLY=true STORE_PACKAGE=$(SUBPACKAGES) && \
export t=$$(docker load -qi "$(XPKG_OUTPUT_DIR)/$(PLATFORM)/$(PROJECT_NAME)-$(SUBPACKAGES)-$(VERSION).xpkg") && \
docker tag $${t##*:} $(BUILD_REGISTRY)/$(PROJECT_NAME)-$(SUBPACKAGES)-$(ARCH); \
$(MAKE) batch-process SUBPACKAGES="$(SUBPACKAGES)" BATCH_PLATFORMS=$(PLATFORM) BUILD_ONLY=true STORE_PACKAGES="$$(tr ' ' ',' <<< "$(SUBPACKAGES)")" && \
for s in $(SUBPACKAGES); do \
export t=$$(docker load -qi "$(XPKG_OUTPUT_DIR)/$(PLATFORM)/$(PROJECT_NAME)-$${s}-$(VERSION).xpkg") && \
docker tag $${t##*:} $(BUILD_REGISTRY)/$(PROJECT_NAME)-$${s}-$(ARCH); \
done; \
fi || $(FAIL)
@$(OK) docker build $${IMAGE};
@$(OK) docker build $${IMAGE}

img.build.shared:
@cp Dockerfile $(IMAGE_TEMP_DIR) || $(FAIL)
Expand Down Expand Up @@ -59,19 +61,19 @@ ifeq (-,$(findstring -,$(VERSION)))
DEP_CONSTRAINT = >= 0.0.0-0
endif
BUILD_ONLY ?= false
STORE_PACKAGE ?= ""
STORE_PACKAGES ?= ""
batch-process: $(UP)
@$(INFO) Batch processing smaller provider packages for: $(SUBPACKAGES)
@$(INFO) Batch processing smaller provider packages for: "$(SUBPACKAGES)"
@mkdir -p "$(XPKG_OUTPUT_DIR)/$(PLATFORM)" && \
$(UP) xpkg batch --smaller-providers $$(echo -n $(SUBPACKAGES) | tr ' ' ',') \
$(UP) xpkg batch --smaller-providers "$$(tr ' ' ',' <<< "$(SUBPACKAGES)")" \
--family-base-image $(BUILD_REGISTRY)/$(PROJECT_NAME) \
--platform $(BATCH_PLATFORMS) \
--provider-name $(PROJECT_NAME) \
--family-package-url-format $(XPKG_REG_ORGS)/%s:$(VERSION) \
--package-repo-override monolith=$(PROJECT_NAME) --package-repo-override config=provider-family-$(PROVIDER_NAME) \
--provider-bin-root $(OUTPUT_DIR)/bin \
--output-dir $(XPKG_OUTPUT_DIR) \
--store-packages $(STORE_PACKAGE) \
--store-packages "$(STORE_PACKAGES)" \
--build-only=$(BUILD_ONLY) \
--examples-root $(ROOT_DIR)/examples \
--examples-group-override monolith=* --examples-group-override config=providerconfig \
Expand All @@ -82,4 +84,4 @@ batch-process: $(UP)
--template-var XpkgRegOrg=$(XPKG_REG_ORGS) --template-var DepConstraint="$(DEP_CONSTRAINT)" --template-var ProviderName=$(PROVIDER_NAME) \
--concurrency $(CONCURRENCY) \
--push-retry 10 || $(FAIL)
@$(OK) Done processing smaller provider packages for: $(SUBPACKAGES)
@$(OK) Done processing smaller provider packages for: "$(SUBPACKAGES)"

0 comments on commit e4e036f

Please sign in to comment.