Skip to content

Commit

Permalink
Make shards reproducible
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jelly committed Jan 15, 2020
1 parent 43ae0ad commit 32c0602
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/version.cr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Shards
VERSION = {{ read_file("#{__DIR__}/../VERSION").chomp }}
BUILD_SHA1 = {{ `git log --format=%h -n 1 2>/dev/null || echo ""`.stringify.chomp }}
BUILD_DATE = {{ `date -u +'%Y-%m-%d'`.stringify.chomp }}
BUILD_DATE = {{ `date -u --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +'%Y-%m-%d'`.stringify.chomp }}

def self.version_string
if BUILD_SHA1.empty?
Expand Down

0 comments on commit 32c0602

Please sign in to comment.