Skip to content

Commit

Permalink
chore(makefile): enhance reproducible build (#1181)
Browse files Browse the repository at this point in the history
Signed-off-by: Batuhan Apaydın <[email protected]>
Co-authored-by: Morten Linderud <[email protected]>
Signed-off-by: Batuhan Apaydın <[email protected]>

Co-authored-by: Morten Linderud <[email protected]>
  • Loading branch information
developer-guy and Foxboron authored Jan 19, 2022
1 parent 43ede27 commit dc72a87
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@ RELEASE_REPO ?= public.ecr.aws/karpenter
RELEASE_VERSION ?= $(shell git describe --tags --always)
RELEASE_PLATFORM ?= --platform=linux/amd64,linux/arm64

# https://reproducible-builds.org/docs/source-date-epoch/
DATE_FMT = +%Y-%m-%dT%H:%M:%SZ
ifdef SOURCE_DATE_EPOCH
BUILD_DATE ?= $(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_DATE ?= $(shell date "$(DATE_FMT)")
endif

## Inject these annotations to cosign signing
COSIGN_FLAGS ?= -a GIT_HASH=$(shell git rev-parse HEAD) -a GIT_VERSION=${RELEASE_VERSION} -a BUILD_DATE=$(shell date +'%Y-%m-%dT%H:%M:%SZ')
COSIGN_FLAGS ?= -a GIT_HASH=$(shell git rev-parse HEAD) -a GIT_VERSION=${RELEASE_VERSION} -a BUILD_DATE=$BUILD_DATE

## Inject the app version into project.Version
LDFLAGS ?= "-ldflags=-X=github.com/aws/karpenter/pkg/utils/project.Version=$(RELEASE_VERSION)"
Expand Down

0 comments on commit dc72a87

Please sign in to comment.