|
1 | 1 | # Image URL to use all building/pushing image targets
|
2 | 2 | IMG ?= public.ecr.aws/a4z9h2b1/cluster-api-provider-capc:latest
|
| 3 | +IMG_LOCAL ?= localhost:5000/cluster-api-provider-cloudstack:latest |
3 | 4 |
|
4 | 5 | # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
|
5 | 6 | ifeq (,$(shell go env GOBIN))
|
@@ -43,6 +44,11 @@ all: build
|
43 | 44 | help: ## Display this help.
|
44 | 45 | @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
45 | 46 |
|
| 47 | + MANIFEST_GEN_INPUTS=$(shell find ./api ./controllers -type f -name "*test*" -prune -o -name "*zz_generated*" -prune -o -print) |
| 48 | + |
| 49 | +# Using a flag file here as config output is too complicated to be a target. |
| 50 | +# The following triggers manifest building if $(IMG) differs from that found in config/default/manager_image_patch.yaml. |
| 51 | +$(shell grep -qs "$(IMG)" config/default/manager_image_patch_edited.yaml || rm -f config/.flag.mk) |
46 | 52 | .PHONY: manifests
|
47 | 53 | manifests: config/.flag.mk ## Generates crd, webhook, rbac, and other configuration manifests from kubebuilder instructions in go comments.
|
48 | 54 | config/.flag.mk: bin/controller-gen $(MANIFEST_GEN_INPUTS)
|
@@ -180,15 +186,36 @@ pkg/mocks/mock%.go: $(shell find ./pkg/cloud -type f -name "*test*" -prune -o -p
|
180 | 186 | ##@ Tilt
|
181 | 187 |
|
182 | 188 | .PHONY: tilt-up
|
183 |
| -tilt-up: cluster-api kind-cluster cluster-api/tilt-settings.json manifests cloud-config # Setup and run tilt for development. |
| 189 | +tilt-up: cluster-api kind-cluster cluster-api/tilt-settings.json manifests cloud-config ## Setup and run tilt for development. |
184 | 190 | export CLOUDSTACK_B64ENCODED_SECRET=$$(base64 -w0 -i cloud-config 2>/dev/null || base64 -b 0 -i cloud-config) && cd cluster-api && tilt up
|
185 | 191 |
|
186 | 192 | .PHONY: kind-cluster
|
187 |
| -kind-cluster: cluster-api # Create a kind cluster with a local Docker repository. |
| 193 | +kind-cluster: cluster-api ## Create a kind cluster with a local Docker repository. |
188 | 194 | -./cluster-api/hack/kind-install-for-capd.sh
|
189 | 195 |
|
190 |
| -cluster-api: # Clone cluster-api repository for tilt use. |
| 196 | +cluster-api: ## Clone cluster-api repository for tilt use. |
191 | 197 | git clone --branch v1.0.0 https://github.com/kubernetes-sigs/cluster-api.git
|
192 | 198 |
|
193 | 199 | cluster-api/tilt-settings.json: hack/tilt-settings.json cluster-api
|
194 | 200 | cp ./hack/tilt-settings.json cluster-api
|
| 201 | + |
| 202 | +##@ End-to-End Testing |
| 203 | + |
| 204 | +CLOUDSTACK_TEMPLATES := $(PROJECT_DIR)/test/e2e/data/infrastructure-cloudstack/v1beta1/ |
| 205 | +CLUSTER_TEMPLATES_INPUTS=$(shell find $(CLOUDSTACK_TEMPLATES) -type d -name "cluster*") |
| 206 | +e2e-cluster-templates: bin/kustomize $(CLOUDSTACK_TEMPLATES)/.templateflag.mk ## Generate cluster template files for e2e testing. |
| 207 | +$(CLOUDSTACK_TEMPLATES)/.templateflag.mk: $(CLUSTER_TEMPLATES_INPUTS) |
| 208 | + $(shell find $(CLOUDSTACK_TEMPLATES) -type d -name "cluster*" -exec bash -c "bin/kustomize build --load-restrictor LoadRestrictionsNone {} > {}.yaml" \;) |
| 209 | + @touch $(CLOUDSTACK_TEMPLATES)/.templateflag.mk |
| 210 | + |
| 211 | +e2e-essentials: bin/ginkgo manifests e2e-cluster-templates kind-cluster ## Fulfill essential tasks for e2e testing. |
| 212 | + IMG=$(IMG_LOCAL) make docker-build docker-push |
| 213 | + |
| 214 | +JOB ?= .* |
| 215 | +run-e2e: e2e-essentials ## Run e2e testing. JOB is an optional REGEXP to select certainn test cases to run. e.g. JOB=PR-Blocking, JOB=Conformance |
| 216 | + cd test/e2e && \ |
| 217 | + ginkgo -v -trace -tags=e2e -focus=$(JOB) -nodes=1 --noColor=false ./... -- \ |
| 218 | + -e2e.artifacts-folder=${PROJECT_DIR}/_artifacts \ |
| 219 | + -e2e.config=${PROJECT_DIR}/test/e2e/config/cloudstack.yaml \ |
| 220 | + -e2e.skip-resource-cleanup=false -e2e.use-existing-cluster=true |
| 221 | + kind delete clusters capi-test |
0 commit comments