Commit ab6f1f0d authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #48708 from bmwiedemann/date

Automatic merge from submit-queue (batch tested with PRs 49222, 49333, 48708, 49337) Allow to override build date 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. Background: issue #48710 when trying to build the kubernetes package for the openSUSE Linux distribution ``` /usr/bin/hyperkube /usr/bin/kubeadm /usr/src/kubernetes/platforms/linux/amd64/e2e.test ``` had a date+time string embedded in them in the format 2018-08-15T19:08:34Z which meant that each build produced new binaries even when nothing actually changed. Those then had to be synced to mirrors, wasting their and our users' bandwidth.
parents e6a4b531 cd0e7b9e
......@@ -130,7 +130,9 @@ kube::version::ldflag() {
kube::version::ldflags() {
kube::version::get_version_vars
local -a ldflags=($(kube::version::ldflag "buildDate" "$(date -u +'%Y-%m-%dT%H:%M:%SZ')"))
local buildDate=
[[ -z ${SOURCE_DATE_EPOCH-} ]] || buildDate="--date=@${SOURCE_DATE_EPOCH}"
local -a ldflags=($(kube::version::ldflag "buildDate" "$(date ${buildDate} -u +'%Y-%m-%dT%H:%M:%SZ')"))
if [[ -n ${KUBE_GIT_COMMIT-} ]]; then
ldflags+=($(kube::version::ldflag "gitCommit" "${KUBE_GIT_COMMIT}"))
ldflags+=($(kube::version::ldflag "gitTreeState" "${KUBE_GIT_TREE_STATE}"))
......
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