Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion apm-lambda-extension/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ AGENT_VERSION = $(shell echo $${BRANCH_NAME} | cut -f 2 -d 'v')
# Add support for SOURCE_DATE_EPOCH and reproducble buils
# See https://reproducible-builds.org/specs/source-date-epoch/
SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct)
DATE_FMT = +%Y%m%d%H%M.%S
# Fallback mechanism to support other systems:
# 1. 'date -d': Busybox and GNU coreutils.
# 2. 'date -r': BSD date. It does not support '-d'.
BUILD_DATE = $(shell date -u -d "@${SOURCE_DATE_EPOCH}" "${DATE_FMT}" 2>/dev/null || date -u -r "${SOURCE_DATE_EPOCH}" "${DATE_FMT}")
Comment on lines 10 to +15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's worth trying to adhere to SOURCE_DATE_EPOCH. This would be simpler by using the --date flag of git log:

BUILD_DATE = $(shell git log -1 --pretty=%cd --date=format:%Y%m%d%H%M.%S)

Copy link
Member Author

@kruskall kruskall Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should still support SOURCE_DATE_EPOCH but that's a valid point.

Moreover avoiding to call date would increase compatibility since touch is POSIX compliant and git is required to build the extension.

I will merge this for now but we can iterate on it!


ifndef GOARCH
GOARCH=amd64
Expand Down Expand Up @@ -62,7 +67,7 @@ endif
zip:
cd bin \
&& rm -f extension.zip \
&& find extensions NOTICE.txt dependencies.asciidoc | xargs touch -d @$(SOURCE_DATE_EPOCH) \
&& find extensions NOTICE.txt dependencies.asciidoc | xargs touch -t ${BUILD_DATE} \
&& zip -X -r extension.zip extensions NOTICE.txt dependencies.asciidoc \
&& cp extension.zip ${GOARCH}.zip
test:
Expand Down