velociraptor/velociraptor-reproducible-timestamp.diff
Jeff Mahoney d5a3e31f79 Accepting request 1060929 from home:jeff_mahoney:branches:security:sensor
- Use obsinfo mtime to produce stable build timestamp (bsc#1207369).

- Update to version 0.6.7.4~git60.8abed37a:
  * http_comms: create ring buffer temporary file in the same directory
  * cronsnoop: plumb in real scope logging
  * cronsnoop: don't treat routine errors as fatal
  * cronsnoop: fix typo

- Use obsinfo mtime to produce stable build timestamp (bsc#1207369).

- Update to version 0.6.7.4~git60.8abed37a:
  * http_comms: create ring buffer temporary file in the same directory
  * cronsnoop: plumb in real scope logging
  * cronsnoop: don't treat routine errors as fatal
  * cronsnoop: fix typo

OBS-URL: https://build.opensuse.org/request/show/1060929
OBS-URL: https://build.opensuse.org/package/show/security:sensor/velociraptor?expand=0&rev=41
2023-01-25 13:29:03 +00:00

31 lines
1.0 KiB
Diff

From: Jeff Mahoney <jeffm@suse.com>
Subject: magefile: use stable timestamps for build
In order to create reprodicible builds, we can't have timestamps that vary
without anything else changing.
diff --git a/magefile.go b/magefile.go
index 16badc2b..76011657 100644
--- a/magefile.go
+++ b/magefile.go
@@ -428,10 +428,18 @@ func build_gui_files() error {
}
func flags() string {
- timestamp := time.Now().Format(time.RFC3339)
+ timestamp := os.Getenv("VELOCIRAPTOR_BUILD_TIME")
+ if timestamp == "" {
+ timestamp = time.Now().Format(time.RFC3339)
+ }
flags := fmt.Sprintf(` -X "www.velocidex.com/golang/velociraptor/config.build_time=%s"`, timestamp)
- flags += fmt.Sprintf(` -X "www.velocidex.com/golang/velociraptor/config.commit_hash=%s"`, hash())
+ head := os.Getenv("VELOCIRAPTOR_GIT_HEAD")
+ if head == "" {
+ head = hash()
+ }
+
+ flags += fmt.Sprintf(` -X "www.velocidex.com/golang/velociraptor/config.commit_hash=%s"`, head)
// If we are running on the CI pipeline we need to know the run
// number and URL so we can report them.