Skip to content

Commit

Permalink
[TOOLS-2221] Add support for arm64 architecture (#61)
Browse files Browse the repository at this point in the history
- Build packages for arm64
- Update docker releases to support multi arch linux/amd64, linux/arm64

Co-authored-by: SP Kesan <[email protected]>
  • Loading branch information
dwelch-spike and spkesan authored Nov 5, 2022
1 parent c45a326 commit 4e82991
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.16-alpine AS builder

ARG VERSION=v1.5.2
ARG VERSION=v1.9.0

ADD . $GOPATH/src/github.com/aerospike/aerospike-prometheus-exporter
WORKDIR $GOPATH/src/github.com/aerospike/aerospike-prometheus-exporter
Expand Down
27 changes: 26 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# Variables required for this Makefile
ROOT_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
VERSION = $(shell git describe --tags --always)
GO_ENV_VARS =

ifdef GOOS
GO_ENV_VARS = GOOS=$(GOOS)
endif

ifdef GOARCH
GO_ENV_VARS += GOARCH=$(GOARCH)
endif

DOCKER_MULTI_ARCH_PLATFORMS = linux/amd64,linux/arm64

# Builds exporter binary
.PHONY: exporter
exporter:
go build -ldflags="-X 'main.version=$(VERSION)'" -o aerospike-prometheus-exporter .
$(GO_ENV_VARS) go build -ldflags="-X 'main.version=$(VERSION)'" -o aerospike-prometheus-exporter .

# Builds RPM, DEB and TAR packages
# Requires FPM package manager
Expand All @@ -32,3 +43,17 @@ clean:
.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=arm64

.PHONY: package-linux-amd64
package-linux-amd64:
$(MAKE) deb rpm tar GOOS=linux GOARCH=amd64 DEB_PKG_ARCH=amd64 ARCH=x86_64
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
fullHost string
config *Config

version = "v1.5.2"
version = "v1.9.0"
)

func main() {
Expand Down
10 changes: 7 additions & 3 deletions pkg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ DESCRIPTION = "Aerospike Prometheus Exporter, An agent to export Aerospike metri
LICENSE = "Apache License 2.0"
URL = "https://github.com/aerospike/aerospike-prometheus-exporter"
VENDOR = "Aerospike, Inc."
ARCH ?= $(shell uname -m)
DEB_PKG_ARCH ?= $(shell dpkg-architecture -q DEB_BUILD_ARCH)


.PHONY: all
Expand All @@ -32,7 +34,8 @@ deb: prep
--license $(LICENSE) \
--url $(URL) \
--vendor $(VENDOR) \
--package $(TARGET_DIR)/aerospike-prometheus-exporter-$(VERSION)-amd64.deb
--architecture $(DEB_PKG_ARCH) \
--package $(TARGET_DIR)/aerospike-prometheus-exporter-$(VERSION)-$(DEB_PKG_ARCH).deb

.PHONY: rpm
rpm: prep
Expand All @@ -49,7 +52,8 @@ rpm: prep
--license $(LICENSE) \
--url $(URL) \
--vendor $(VENDOR) \
--package $(TARGET_DIR)/aerospike-prometheus-exporter-$(VERSION)-x86_64.rpm
--architecture $(ARCH) \
--package $(TARGET_DIR)/aerospike-prometheus-exporter-$(VERSION)-$(ARCH).rpm

.PHONY: tar
tar: prep
Expand All @@ -66,7 +70,7 @@ tar: prep
--license $(LICENSE) \
--url $(URL) \
--vendor $(VENDOR) \
--package $(TARGET_DIR)/aerospike-prometheus-exporter-$(VERSION).tar
--package $(TARGET_DIR)/aerospike-prometheus-exporter-$(VERSION)-$(ARCH).tar

.PHONY: prep
prep:
Expand Down

0 comments on commit 4e82991

Please sign in to comment.