-
Notifications
You must be signed in to change notification settings - Fork 495
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
build: set provenance vcs details #1462
Conversation
e68c2e4
to
4c6b5c3
Compare
bf65414
to
8142e38
Compare
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.
This PR shouldn't care about provenance attestations, just set the vcs options. Provenance is only defined by #1412
build/build.go
Outdated
return nil, nil, err | ||
} | ||
} | ||
gitlabels := os.Getenv("BUILDX_GIT_LABELS") |
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.
BUILDX_GIT_LABELS
should remain as it is you can add a new env BUILDX_GIT_INFO
that defaults to true.
If BUILDX_GIT_LABELS
is true then set labels.
If BUILDX_GIT_INFO
is not false then set vcs
. Do not check anything about provenance mode.
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.
Changed the behavior with your suggestion
8142e38
to
c2359dc
Compare
c2359dc
to
d922332
Compare
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.
cc @cdupuis
labels[ocispecs.AnnotationSource] = strings.TrimSpace(string(out)) | ||
if sha, err := gitc.FullCommit(); err == nil && sha != "" { | ||
gitdetails.Revision = sha | ||
if gitc.IsDirty() { |
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.
It looks like this increases the amount of git
calls compared to the previous implementation? Can be handled in follow up, but every invocation counts.
Edit: I might have counted the requests wrong. Looks like previous also did this with 2 commands.
Finally this code is getting cleaned up. Thanks @crazy-max and @tonistiigi. |
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
d922332
to
6ad5e2f
Compare
follow-up moby/buildkit#3240 (comment)
Sets provenance vcs details.
Signed-off-by: CrazyMax crazy-max@users.noreply.github.com