Allow to override build date with SOURCE_DATE_EPOCH (#1099)

in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

Also use UTC to be independent of timezone.

This variant only works with GNU date.

This was originally merged in 23ac2b6c9f
and then accidentally reverted in d31328a576
mine
Bernhard M. Wiedemann 2021-04-27 15:48:26 +02:00 committed by GitHub
parent 3ea4ecabed
commit f2ab9dc2f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -1,7 +1,8 @@
NAME := k9s
PACKAGE := github.com/derailed/$(NAME)
GIT := $(shell git rev-parse --short HEAD)
DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
SOURCE_DATE_EPOCH ?= $(shell date +%s)
DATE := $(shell date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ")
VERSION ?= v0.24.7
IMG_NAME := derailed/k9s
IMAGE := ${IMG_NAME}:${VERSION}