Skip to content
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

Merged
merged 1 commit into from
Dec 14, 2022
Merged

Conversation

crazy-max
Copy link
Member

follow-up moby/buildkit#3240 (comment)

Sets provenance vcs details.

Signed-off-by: CrazyMax crazy-max@users.noreply.github.com

build/build.go Outdated Show resolved Hide resolved
build/git.go Outdated Show resolved Hide resolved
@crazy-max crazy-max marked this pull request as ready for review December 13, 2022 11:11
build/build.go Outdated Show resolved Hide resolved
@crazy-max crazy-max force-pushed the attest-vcs branch 2 times, most recently from bf65414 to 8142e38 Compare December 13, 2022 14:27
@crazy-max crazy-max added this to the v0.10.0 milestone Dec 13, 2022
Copy link
Member

@tonistiigi tonistiigi left a 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")
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build/git.go Show resolved Hide resolved
labels[ocispecs.AnnotationSource] = strings.TrimSpace(string(out))
if sha, err := gitc.FullCommit(); err == nil && sha != "" {
gitdetails.Revision = sha
if gitc.IsDirty() {
Copy link
Member

@tonistiigi tonistiigi Dec 13, 2022

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.

build/git.go Outdated Show resolved Hide resolved
@cdupuis
Copy link
Contributor

cdupuis commented Dec 13, 2022

Finally this code is getting cleaned up. Thanks @crazy-max and @tonistiigi.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants