mirror of
https://github.com/grafana/grafana.git
synced 2025-01-27 00:37:04 -06:00
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
This commit is contained in:
parent
10fe101add
commit
ce7a8dde83
5
build.go
5
build.go
@ -592,6 +592,11 @@ func getGitSha() string {
|
||||
}
|
||||
|
||||
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")
|
||||
if err != nil {
|
||||
return time.Now().Unix()
|
||||
|
Loading…
Reference in New Issue
Block a user