build: set provenance vcs details#1462
Conversation
e68c2e4 to
4c6b5c3
Compare
bf65414 to
8142e38
Compare
tonistiigi
left a comment
There was a problem hiding this comment.
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.
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.
Changed the behavior with your suggestion
8142e38 to
c2359dc
Compare
c2359dc to
d922332
Compare
| 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.
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