From 01e6c293ab311a6e74680209657260837564be35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Wed, 5 Aug 2026 11:19:54 +0200 Subject: [PATCH 1/2] Remove date from build time variables There is no apparent purpose to having a build date, in contrary it is actively harmful regarding reproducible builds and such things. This patch removes the build time date and all mentions of it therefore. --- main.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/main.go b/main.go index fe54c8d..3aaf192 100644 --- a/main.go +++ b/main.go @@ -23,7 +23,6 @@ var ( // These get filled at build time with the proper values. version = "development" commit = "HEAD" - date = "latest" ) // buildVersion creates a string that contains the executable's version @@ -34,10 +33,6 @@ func buildVersion() string { result = fmt.Sprintf("%s\ncommit: %s", result, commit) } - if date != "" { - result = fmt.Sprintf("%s\ndate: %s", result, date) - } - return result } @@ -68,7 +63,7 @@ func main() { // Create Icinga Client icingaClient := icinga2.NewClient(cfg, logger) - logger.Info("Starting alertmanager-icinga-bridge", "version", version, "commit", commit, "date", date, "component", "main") + logger.Info("Starting alertmanager-icinga-bridge", "version", version, "commit", commit, "component", "main") // Create and start the Service Garbage Collector garbagecol := gc.NewGarbageCollector(cfg, logger, icingaClient) From c2a2e964074a448428ce8f300be7261b718c9e60 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Wed, 5 Aug 2026 11:24:18 +0200 Subject: [PATCH 2/2] [squash] --- .goreleaser.yml | 1 - Dockerfile | 3 +-- Makefile | 4 +--- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 34b7387..c07ae82 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -15,7 +15,6 @@ builds: - >- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} - -X main.date={{.CommitDate}} release: draft: true github: diff --git a/Dockerfile b/Dockerfile index bb5b5f4..c97c06b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,6 @@ FROM docker.io/golang:latest as builder ARG BRIDGE_VERSION=development ARG BRIDGE_COMMIT=HEAD -ARG BRIDGE_DATE=latest ENV CGO_ENABLED=0 @@ -13,7 +12,7 @@ WORKDIR /go/src/app COPY . . RUN set -ex; \ - go build -ldflags="-s -w -X main.version=${BRIDGE_VERSION} -X main.commit=${BRIDGE_COMMIT} -X main.date=${BRIDGE_DATE}" -o /go/bin/alertmanager-icinga-bridge + go build -ldflags="-s -w -X main.version=${BRIDGE_VERSION} -X main.commit=${BRIDGE_COMMIT}" -o /go/bin/alertmanager-icinga-bridge # Final Image FROM gcr.io/distroless/static:nonroot diff --git a/Makefile b/Makefile index dfa00fd..d893622 100644 --- a/Makefile +++ b/Makefile @@ -3,14 +3,12 @@ CONTAINER_RUNTIME?=podman COMMIT := $(shell git rev-parse HEAD) -DATE := $(shell date --iso-8601) VERSION?=latest build-image: $(CONTAINER_RUNTIME) build --pull \ --build-arg BRIDGE_VERSION=$(VERSION) \ --build-arg BRIDGE_COMMIT=$(COMMIT) \ - --build-arg BRIDGE_DATE=$(DATE) \ -t ghcr.io/netways/alertmanager-icinga-bridge:latest . build: mkdir -p dist; \ @@ -19,7 +17,7 @@ release-snapshot: goreleaser release --snapshot --clean release: mkdir -p dist;\ - CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)" -o dist/alertmanager-icinga-bridge + CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT)" -o dist/alertmanager-icinga-bridge lint: go fmt $(go list ./... | grep -v /vendor/) vet: