Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uptest family providers #903

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 34 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,21 @@ uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
uptest-local:
@$(WARN) "this target is deprecated, please use 'make uptest' instead"

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

local-deploy: build-monolith controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME)-monolith
@$(INFO) running locally built provider
@$(KUBECTL) wait provider.pkg $(PROJECT_NAME)-monolith --for condition=Healthy --timeout 5m
@$(KUBECTL) -n upbound-system wait --for=condition=Available deployment --all --timeout=5m
@$(OK) running locally built provider
XPKG_SKIP_DEP_RESOLUTION := true

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-provider.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 @@ -209,7 +216,26 @@ local-deploy: build-monolith controlplane.up local.xpkg.deploy.provider.$(PROJEC
# $ 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
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 ' ' ',' <<< $${INSTALL_APIS})"; \
INSTALL_APIS="$$(tr -s ',' <<< "$${INSTALL_APIS}")"; \
$(INFO) Building and deploying resource providers for the short API groups: $${INSTALL_APIS}; \
$(MAKE) build-provider.$${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
22 changes: 12 additions & 10 deletions cluster/images/provider-aws/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ img.build:
@$(INFO) Family base image to build: $(IMAGE)
@$(INFO) Building image $${IMAGE}; \
$(MAKE) BUILD_ARGS="--load ${BUILD_ARGS}" IMAGE=$${IMAGE} XPKG_REG_ORGS=$(XPKG_REG_ORGS) img.build.shared; \
if [[ "$${LOAD_MONOLITH}" == "true" ]]; then \
$(MAKE) batch-process SUBPACKAGES=monolith BATCH_PLATFORMS=$(PLATFORM) BUILD_ONLY=true STORE_PACKAGE=monolith && \
export t=$$(docker load -qi "$(XPKG_OUTPUT_DIR)/$(PLATFORM)/$(PROJECT_NAME)-monolith-$(VERSION).xpkg") && \
docker tag $${t##*:} $(BUILD_REGISTRY)/$(PROJECT_NAME)-monolith-$(ARCH); \
if [[ "$${LOAD_PACKAGES}" == "true" ]]; then \
$(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)"
Loading