From 0cb0a1baa518e4305c714942e9fcd34def7c5494 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Wed, 28 May 2025 18:30:03 +0200 Subject: [PATCH] Use S_D_E if set for build time When rebuilding gitlab-shell the build time is set to the current date making it not reproducible. Taking the time from SOURCE_DATE_EPOCH makes the package reproducible after rebuilding. See: https://reproducible-builds.org/docs/source-date-epoch/ --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cafc207df..0782aaeef 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,12 @@ FIPS_MODE ?= 0 OS := $(shell uname | tr A-Z a-z) GO_SOURCES := $(shell git ls-files \*.go) VERSION_STRING := $(shell git describe --match v* 2>/dev/null || awk '$$0="v"$$0' VERSION 2>/dev/null || echo unknown) -BUILD_TIME := $(shell date -u +%Y%m%d.%H%M%S) +DATE_FMT = +%Y%m%d.%H%M%S +ifdef SOURCE_DATE_EPOCH + BUILD_TIME := $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u "$(DATE_FMT)") +else + BUILD_TIME := $(shell date -u "$(DATE_FMT)") +endif GO_TAGS := tracer_static tracer_static_jaeger continuous_profiler_stackdriver ARCH ?= $(shell uname -m | sed -e 's/x86_64/amd64/' | sed -e 's/aarch64/arm64/') -- GitLab