Commit 674d02a4 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'repro-builds' into 'master'

Reproducible Builds: Use SOURCE_DATE_EPOCH for build time if present

See merge request gitlab-org/gitlab!68464
parents 48709784 4d102128
...@@ -6,7 +6,12 @@ VERSION_STRING := $(shell git describe) ...@@ -6,7 +6,12 @@ VERSION_STRING := $(shell git describe)
ifeq ($(strip $(VERSION_STRING)),) ifeq ($(strip $(VERSION_STRING)),)
VERSION_STRING := v$(shell cat VERSION) VERSION_STRING := v$(shell cat VERSION)
endif endif
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
GOBUILD := go build -ldflags "-X main.Version=$(VERSION_STRING) -X main.BuildTime=$(BUILD_TIME)" GOBUILD := go build -ldflags "-X main.Version=$(VERSION_STRING) -X main.BuildTime=$(BUILD_TIME)"
EXE_ALL := gitlab-resize-image gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse EXE_ALL := gitlab-resize-image gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse
INSTALL := install INSTALL := install
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment