-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
87 lines (71 loc) · 2.38 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
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
# Variables required for this Makefile
# Include all common variables
include Makefile.vars
# Builds exporter binary
.PHONY: exporter
exporter:
@echo $(GO_FIPS)
$(GO_ENV_VARS) GOEXPERIMENT=$(GO_FIPS) go build -ldflags="-X 'main.version=$(VERSION)'" -o aerospike-prometheus-exporter ./cmd
.PHONY: fipsparam
fipsparam:
ifeq ($(APE_SUPPORTED_OS),validfipsos)
@echo "Setting FIPS required params"
$(eval GO_FIPS=$(GO_BORINGCRYPTO))
$(eval PKG_FILENAME=$(FIPS_PKG_FILENAME))
else
@echo "Fips Exporter build is supported only on CentOS 8 or Red Hat 8 versions or have Golang v1.20 and above"
exit 1
endif
.PHONY: fmt
fmt: ## Run go fmt against code.
go fmt ./...
.PHONY: lint
lint:
## install golangci-lint from https://raw.githubusercontent.com/golangci/golangci-lint , install and include in PATH
## Run golangci-lint against code.
golangci-lint run
.PHONY: test
test: ## Run all the test-cases defined in this folder.
## for verbose mode use go test -v ./...
go test ./...
# Builds RPM, DEB and TAR packages
# Requires FPM package manager
.PHONY: deb
deb: exporter
$(MAKE) -C $(ROOT_DIR)/pkg/ deb
.PHONY: fips-deb
fips-deb: fipsparam exporter
$(MAKE) -C $(ROOT_DIR)/pkg/ fips-deb
.PHONY: rpm
rpm: exporter
$(MAKE) -C $(ROOT_DIR)/pkg/ rpm
.PHONY: fips-rpm
fips-rpm: fipsparam exporter
$(MAKE) -C $(ROOT_DIR)/pkg/ fips-rpm
.PHONY: tar
tar: exporter
$(MAKE) -C $(ROOT_DIR)/pkg/ tar
.PHONY: fips-tar
fips-tar: fipsparam exporter
$(MAKE) -C $(ROOT_DIR)/pkg/ fips-tar
# Clean up
.PHONY: clean
clean:
rm -rf aerospike-prometheus-exporter
$(MAKE) -C $(ROOT_DIR)/pkg/ $@
# Builds exporter docker image
# Requires docker
.PHONY: docker
docker:
docker build --build-arg VERSION=$(VERSION) . -t aerospike/aerospike-prometheus-exporter:latest
# NOTE: this builds and pushes the image to aerospike/aerospike-prometheus-exporter docker hub repository
# Use this target only for release
.PHONY: release-docker-multi-arch
release-docker-multi-arch:
docker buildx build --build-arg VERSION=$(VERSION) --platform $(DOCKER_MULTI_ARCH_PLATFORMS) --push . -t aerospike/aerospike-prometheus-exporter:latest -t aerospike/aerospike-prometheus-exporter:$(VERSION)
.PHONY: package-linux-arm64
package-linux-arm64:
$(MAKE) deb rpm tar GOOS=linux GOARCH=arm64 DEB_PKG_ARCH=arm64 ARCH=aarch64
.PHONY: package-linux-amd64
package-linux-amd64:
$(MAKE) deb rpm tar GOOS=linux GOARCH=amd64 DEB_PKG_ARCH=amd64 ARCH=x86_64