From 20d9a56cb03e7c5ea7c81bd2e996fb67a051738b Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Wed, 27 May 2026 13:35:11 +0200 Subject: [PATCH 1/2] functions: Set SOURCE_DATE_EPOCH from core's HEAD commit timestamp Mirrors what build-in-container-inner.sh already does, so CI builds that invoke the build scripts directly also produce reproducible artifacts. Ticket: ENT-14061 Signed-off-by: Lars Erik Wik --- build-scripts/functions | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build-scripts/functions b/build-scripts/functions index 769b8f55c..3f19b7a92 100644 --- a/build-scripts/functions +++ b/build-scripts/functions @@ -796,4 +796,11 @@ log_error() { echo "$(basename "$0"): error:" "$@" >&2 } +# Pin embedded build timestamps so two builds of the same source produce identical binaries. +if [ -z "$SOURCE_DATE_EPOCH" ] && [ -d "$BASEDIR/core/.git" ]; then + SOURCE_DATE_EPOCH=$(git -C "$BASEDIR/core" log -1 --format=%ct) + export SOURCE_DATE_EPOCH + log_info "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" +fi + _IS_FUNCTIONS_SOURCED=yes From ebd409748eb237ba644ee50779fc464ff7677bb0 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Mon, 1 Jun 2026 10:47:38 +0200 Subject: [PATCH 2/2] functions: Persist SOURCE_DATE_EPOCH for downstream jobs Write the value into output/SOURCE_DATE_EPOCH on the bootstrap-pr build slave (where core/.git exists) so downstream jobs that consume the artifacts bundle - and no longer have core/.git - can read the same value back instead of leaving the variable unset. Ticket: ENT-14061 Signed-off-by: Lars Erik Wik --- build-scripts/functions | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/build-scripts/functions b/build-scripts/functions index 3f19b7a92..325b1c9b0 100644 --- a/build-scripts/functions +++ b/build-scripts/functions @@ -797,10 +797,21 @@ log_error() { } # Pin embedded build timestamps so two builds of the same source produce identical binaries. -if [ -z "$SOURCE_DATE_EPOCH" ] && [ -d "$BASEDIR/core/.git" ]; then - SOURCE_DATE_EPOCH=$(git -C "$BASEDIR/core" log -1 --format=%ct) - export SOURCE_DATE_EPOCH - log_info "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" +# In bootstrap-pr we derive it from core's HEAD commit time and persist it into +# output/ so downstream jobs (which consume the bootstrap artifacts but no +# longer have core/.git) can recover the same value. +if [ -z "$SOURCE_DATE_EPOCH" ]; then + if [ -d "$BASEDIR/core/.git" ]; then + SOURCE_DATE_EPOCH=$(git -C "$BASEDIR/core" log -1 --format=%ct) + mkdir -p "$BASEDIR/output" + echo "$SOURCE_DATE_EPOCH" > "$BASEDIR/output/SOURCE_DATE_EPOCH" + elif [ -f "$BASEDIR/output/SOURCE_DATE_EPOCH" ]; then + SOURCE_DATE_EPOCH=$(cat "$BASEDIR/output/SOURCE_DATE_EPOCH") + fi + if [ -n "$SOURCE_DATE_EPOCH" ]; then + export SOURCE_DATE_EPOCH + log_info "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" + fi fi _IS_FUNCTIONS_SOURCED=yes