-
Notifications
You must be signed in to change notification settings - Fork 596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(reproducibility): add buildid= and trimpath #642
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition 🙌 . Looks like the snapshot is failing, will kick it off again to see if it was intermittent or a related problem to the change.
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 :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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 [email protected]