forked from GoogleContainerTools/kpt-config-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.e2e
112 lines (94 loc) · 3.86 KB
/
Makefile.e2e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# e2e related build rules
E2E_PARAMS := \
IMAGE_TAG=$(IMAGE_TAG) \
GCP_PROJECT=$(GCP_PROJECT) \
REGISTRY=$(REGISTRY) \
GOTOPT2_BINARY := docker run -i -u $(UID):$(GID) $(BUILDENV_IMAGE) /bin/gotopt2
GCP_ZONE ?= us-central1-a
GKE_E2E_TIMEOUT ?= 6h
# Configurable timeout for running the e2e tests on kind clusters.
# The fewer clusters being used, the higher the timeout needs to be.
KIND_E2E_TIMEOUT ?= 60m
# Configurable number of kind clusters to run the tests against.
# A higher number will lead to a faster test execution, but may cause stability
# issues depending on the size of the host machine.
KIND_NUM_CLUSTERS ?= 15
E2E_CREATE_CLUSTERS ?= "true"
E2E_DESTROY_CLUSTERS ?= "true"
# Runs nomos vet locally for example repos.
# Requires kubeconfig set up properly with Nomos cluster.
# This is now a duplicate of cli.bats from the e2e tests framework,
# but can run locally without any of the setup.
test-nomos-vet-local: build
@echo "Running test-nomos-vet-local..."
$(NOMOS_LOCAL) --validate vet --path=./examples/acme
$(NOMOS_LOCAL) vet --path=./examples/foo-corp-example/foo-corp
@rm -rf ./.output/tmp/empty
@mkdir ./.output/tmp/empty
@cd ./.output/tmp/empty && git init && git checkout -b main && $(NOMOS_LOCAL) init && $(NOMOS_LOCAL) vet
include Makefile.e2e.ci
__install-nomos-local:
@GO111MODULE=on go install ./cmd/nomos/nomos.go
# Run the Go e2e tests after building images/manifests.
# Useful for when you're actively modifying code between runs.
.PHONY: test-e2e
test-e2e: config-sync-manifest-local __install-nomos-local test-e2e-nobuild
# Run the Go e2e tests without building images/manifests.
# Useful for modifying test code and rerunning tests without rebuilding images.
.PHONY: test-e2e-go-nobuild
test-e2e-nobuild: "$(KUSTOMIZE)" "$(HELM)" "$(CRANE)" "$(COSIGN)"
./scripts/e2e.sh $(E2E_ARGS)
# Run the Go e2e tests on GKE without building images/manifests.
# The test framework will create/teardown the GKE clusters.
.PHONY: test-e2e-gke-nobuild
test-e2e-gke-nobuild:
$(MAKE) test-e2e-nobuild \
E2E_ARGS="$(E2E_ARGS) --timeout=$(GKE_E2E_TIMEOUT) --share-test-env --test-cluster=gke" \
GCP_PROJECT=$(GCP_PROJECT) \
GCP_ZONE=$(GCP_ZONE) \
GCP_REGION=$(GCP_REGION) \
E2E_CREATE_CLUSTERS=$(E2E_CREATE_CLUSTERS) \
E2E_DESTROY_CLUSTERS=$(E2E_DESTROY_CLUSTERS)
# Build Config Sync and run e2e tests on GKE
.PHONY: test-e2e-gke
test-e2e-gke: config-sync-manifest test-e2e-gke-nobuild
KIND_IMAGE := "kind-image"
.PHONY: build-kind-e2e
build-kind-e2e: "$(KIND)" "$(KUSTOMIZE)" "$(HELM)" "$(CRANE)" "$(COSIGN)"
@echo "+++ Building $(KIND_IMAGE)"
docker buildx build . \
--target kind-e2e \
-f build/prow/e2e/Dockerfile \
-t $(KIND_IMAGE) \
$(DOCKER_BUILD_ARGS)
# This target runs all the e2e tests on kind clusters.
# This is the target used by the presubmits.
.PHONY: test-e2e-kind
test-e2e-kind: config-sync-manifest-local build-kind-e2e
kind delete clusters --all
docker run \
$(DOCKER_INTERACTIVE) \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(ARTIFACTS):/logs/artifacts \
--env ARTIFACTS="/logs/artifacts" \
--network="host" \
--rm \
$(KIND_IMAGE) \
./scripts/e2e.sh \
--share-test-env \
--timeout $(KIND_E2E_TIMEOUT) \
--test.v -v \
--num-clusters $(KIND_NUM_CLUSTERS) \
$(E2E_ARGS)
# This target runs the first group of e2e tests.
.PHONY: test-e2e-kind-test-group1
test-e2e-kind-test-group1:
$(MAKE) E2E_ARGS="$(E2E_ARGS) --test-features=acm-controller,selector,lifecycle,nomos-cli,drift-control" test-e2e-kind
# This target runs the second group of e2e tests.
.PHONY: test-e2e-kind-test-group2
test-e2e-kind-test-group2:
$(MAKE) E2E_ARGS="$(E2E_ARGS) --test-features=sync-source,reconciliation-1" test-e2e-kind
# This target runs the third group of e2e tests.
.PHONY: test-e2e-kind-test-group3
test-e2e-kind-test-group3:
$(MAKE) E2E_ARGS="$(E2E_ARGS) --test-features=reconciliation-2,multi-repos,override-api,hydration" test-e2e-kind