forked from openshift/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (31 loc) · 2.1 KB
/
Makefile
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
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
# Expected a full x.y.z semantic version.
# DO NOT UPDATE THIS until you have published downstream builds for the kubebuilder tools, and checked
# that there is an equivalent upstream version as well. Check upstream at https://storage.googleapis.com/kubebuilder-tools.
# Publish downstream with `make -C tools publish-kubebuilder-tools`, see help text there for updating flags before publshing.
ENVTEST_K8S_VERSION = 1.29.1
# In case of emergency, use these to provide separate upstream/downstream K8s versions for testing.
ENVTEST_K8S_DOWNSTREAM_VERSION = ${ENVTEST_K8S_VERSION}
ENVTEST_K8S_UPSTREAM_VERSION = ${ENVTEST_K8S_VERSION}
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
ENVTEST = go run ${PROJECT_DIR}/vendor/sigs.k8s.io/controller-runtime/tools/setup-envtest
.PHONY: integration
integration: verify-vendor test
.PHONY: test
test: test-downstream
.PHONY: test-upstream
test-upstream: ## Run only the tests. Use upstream Kubebuilder artifacts. Note, if downstream KAS carries changes, this may not pass.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_UPSTREAM_VERSION) -p path --bin-dir $(PROJECT_DIR)/bin)" ./hack/test.sh
.PHONY: test-downstream
test-downstream: ## Run only the tests. Use downstream Kubebuilder artifacts published in a GCS bucket in openshift-gce-devel.
@# This should be the same as upstream, except it uses the --remote-bucket option to set to our public bucket, not upstream's.
@# Ref: https://github.com/kubernetes-sigs/controller-runtime/blob/1382d7d6774050cd844b7f0c3cd63d5258c1b714/tools/setup-envtest/main.go#L52 and https://github.com/kubernetes-sigs/controller-runtime/tree/main/tools/setup-envtest#what-if-i-dont-want-to-talk-to-the-internet
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_DOWNSTREAM_VERSION) -p path --bin-dir $(PROJECT_DIR)/bin --remote-bucket openshift-kubebuilder-tools)" ./hack/test.sh
.PHONY: vendor
vendor:
go mod tidy
go mod vendor
go mod verify
.PHONY: verify-vendor
verify-vendor: vendor
git diff --exit-code vendor