Skip to content

Commit 35303e1

Browse files
jellyysbaddaden
authored andcommitted
Make shards reproducible
By default the shards binary embeds a build date which makes it impossible to rebuild due to time differences. Use SOURCE_DATE_EPOCH to use a predictable timestamp as input for the date function which in turn makes shards reproducible. Motiviation: https://reproducible-builds.org
1 parent 43ae0ad commit 35303e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/version.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Shards
22
VERSION = {{ read_file("#{__DIR__}/../VERSION").chomp }}
33
BUILD_SHA1 = {{ `git log --format=%h -n 1 2>/dev/null || echo ""`.stringify.chomp }}
4-
BUILD_DATE = {{ `date -u +'%Y-%m-%d'`.stringify.chomp }}
4+
BUILD_DATE = Time.unix({{ (env("SOURCE_DATE_EPOCH") || `date +%s`).to_i }}).to_s("%Y-%m-%d")
55

66
def self.version_string
77
if BUILD_SHA1.empty?

0 commit comments

Comments
 (0)