chore(reproducibility): add buildid= and trimpath#642
chore(reproducibility): add buildid= and trimpath#642developer-guy wants to merge 1 commit intoanchore:mainfrom
Conversation
8ed72ed to
325c1bf
Compare
|
@developer-guy out of curiosity, why the change to explicitly specify GOPATH in the workflow files? |
|
I saw it from the documentation: |
|
I see the reason for
Where there was a change to explicitly set |
to be able to use it in .goreleaser.yml via .Env, I think |
325c1bf to
b7fd314
Compare
I've replaced with ${{ env.GOPATH }} this one. |
Right, but doesn't this do nothing? ... since this is setting an environment variable based off of the current environment variable value of the same name? Are these 'GOPATH' changes necessary? |
b7fd314 to
11d6142
Compare
|
I reverted GOPATH changes, let's what will happen 😮 |
@wagoodman :( |
wagoodman
left a comment
There was a problem hiding this comment.
We shouldn't need to set the GOPATH explicitly for this change. Additionally I think we should be using the build trimpath flag and not the gcflag trimpath=<some-path>. I think this would be the equivalent change:
- id: linux-build
binary: grype
goos:
- linux
goarch:
- amd64
- arm64
# set the modified timestamp on the output binary to the git timestamp to ensure a reproducible build
mod_timestamp: &build-timestamp '{{ .CommitTimestamp }}'
env: &build-env
- CGO_ENABLED=0
flags: &build-flags
- -trimpath
ldflags: &build-ldflags |
-buildid=
-w
-s
-extldflags '-static'
-X github.com/anchore/grype/internal/version.version={{.Version}}
-X github.com/anchore/grype/internal/version.syftVersion={{.Env.SYFT_VERSION}}
-X github.com/anchore/grype/internal/version.gitCommit={{.Commit}}
-X github.com/anchore/grype/internal/version.buildDate={{.CommitDate}}
-X github.com/anchore/grype/internal/version.gitDescription={{.Summary}}I made one extra update:
-X github.com/anchore/grype/internal/version.buildDate={{.CommitDate}}
... so the commit date is referenced.
Note: this would not get us 100% to reproducible builds, but I'm not certain what's left to close the gap.
|
I think we should get build date via https://reproducible-builds.org/docs/source-date-epoch/ |
504055e to
2fcf3bf
Compare
|
seems everything is fine @wagoodman, thanks a ton 🙋🏻♂️ |
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
2fcf3bf to
dfc0225
Compare
|
Clarifying question: why not use the built in goreleaser I can't seem to parse the specific behavior of the set of |
|
@developer-guy friendly nudge on #642 (comment) (also 1:1 with anchore/syft#847) |
|
I'm going to close this as stale, but please reach out on a new issue if you wanted to chat further about this. |
Signed-off-by: Batuhan Apaydın batuhan.apaydin@trendyol.com