Commit ce7a8dde by jelle van der Waa Committed by Torkel Ödegaard

Build: Support SOURCE_DATE_EPOCH for reproducible builds (#18953)

If grafana is build from a non-git source a new timestamp is used every build which makes grafana binaries
non-reproducible.

Motivation: https://reproducible-builds.org
parent 10fe101a
...@@ -592,6 +592,11 @@ func getGitSha() string { ...@@ -592,6 +592,11 @@ func getGitSha() string {
} }
func buildStamp() int64 { func buildStamp() int64 {
// use SOURCE_DATE_EPOCH if set.
if s, _ := strconv.ParseInt(os.Getenv("SOURCE_DATE_EPOCH"), 10, 64); s > 0 {
return s
}
bs, err := runError("git", "show", "-s", "--format=%ct") bs, err := runError("git", "show", "-s", "--format=%ct")
if err != nil { if err != nil {
return time.Now().Unix() return time.Now().Unix()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment