-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (48 loc) · 2.08 KB
/
Copy pathMakefile
File metadata and controls
62 lines (48 loc) · 2.08 KB
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
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
ENVTEST_K8S_VERSION = 1.25.0
ENVTEST ?= $(LOCALBIN)/setup-envtest
ifndef TEMP_DIR
TEMP_DIR:=$(shell mktemp -d /tmp/ibm-finops-agent.XXXXXX)
endif
ifndef IMAGE_TAG
IMAGE_TAG:=localhost/e2e/ibm-finops-agent:e2e
endif
test: envtest
@KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile coverage.out
.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
@test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
ci-lint:
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.2.1
golangci-lint run
# $(call TEST_KUBERNETES, image_tag, prefix, git_commit)
define TEST_KUBERNETES
KUBERNETES_VERSION=$(1) IMAGE=$(IMAGE_TAG) TEMP_DIR=$(TEMP_DIR) e2e/e2e.sh; \
if [ $$? != 0 ]; then \
exit 1; \
fi;
endef
# To run the e2e tests locally, have an image built off the total UA docker file tagged 'localhost/e2e/ibm-finops-agent:e2e'
# and export it to IMAGE_TAG. This could be manually configured by editing the HELM_INSTALL variable in the e2e.sh files
e2e-test: add-e2e-chart test-k8s-1.33.0 test-k8s-1.32.0 test-k8s-1.31.0 test-k8s-1.30.0
add-e2e-chart:
helm repo add ibm-finops https://kubecost.github.io/finops-agent-chart
helm repo add localstack https://helm.localstack.cloud
test-k8s-1.33.0:
$(call TEST_KUBERNETES,v1.33.0)
test-k8s-1.32.0:
$(call TEST_KUBERNETES,v1.32.0)
test-k8s-1.31.0:
$(call TEST_KUBERNETES,v1.31.0)
test-k8s-1.30.0:
$(call TEST_KUBERNETES,v1.30.0)
.PHONY: podman-build-push
podman-build-push:
podman manifest rm $(IMAGETAG) > /dev/null 2>&1 || true
podman manifest create $(IMAGETAG)
podman build --rm --platform "linux/arm64" -f ./ibm-finops-agent/Dockerfile --manifest $(IMAGETAG) -t $(IMAGETAG)-arm64 ./ibm-finops-agent
podman build --rm --platform "linux/amd64" -f ./ibm-finops-agent/Dockerfile --manifest $(IMAGETAG) -t $(IMAGETAG)-amd64 ./ibm-finops-agent
podman manifest push $(IMAGETAG)