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

protobuf: remove gogoproto #2713

Merged
merged 1 commit into from
Oct 2, 2024
Merged

Conversation

jsternberg
Copy link
Collaborator

@jsternberg jsternberg commented Sep 26, 2024

Removes gogo/protobuf from buildx and updates to a version of
moby/buildkit where gogo is removed.

This also changes how the proto files are generated. This is because
newer versions of protobuf are more strict about name conflicts. If two
files have the same name (even if they are relative paths) and are used
in different protoc commands, they'll conflict in the registry.

Since protobuf file generation doesn't work very well with
paths=source_relative, this removes the go:generate expression and
just relies on the dockerfile to perform the generation.

@jsternberg jsternberg changed the title vendor: update moby/buildkit for gogo proto removal protobuf: remove gogoproto Sep 26, 2024
@jsternberg jsternberg force-pushed the gogoproto-remove branch 4 times, most recently from 5c304ae to 3cb79af Compare September 27, 2024 02:44
@jsternberg jsternberg marked this pull request as ready for review September 27, 2024 15:04
go.mod Outdated
go 1.21.0
go 1.22.0

toolchain go1.22.2
Copy link
Member

Choose a reason for hiding this comment

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

remove toolchain, see #2577 (review)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm honestly not even sure what added this.

Removes gogo/protobuf from buildx and updates to a version of
moby/buildkit where gogo is removed.

This also changes how the proto files are generated. This is because
newer versions of protobuf are more strict about name conflicts. If two
files have the same name (even if they are relative paths) and are used
in different protoc commands, they'll conflict in the registry.

Since protobuf file generation doesn't work very well with
`paths=source_relative`, this removes the `go:generate` expression and
just relies on the dockerfile to perform the generation.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
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.

Some follow-ups but I think we can bring this in.

@@ -43,7 +44,7 @@ func createTempDockerfileFromURL(ctx context.Context, d *driver.DriverHandle, ur
if err != nil {
return nil, err
}
if stat.Size() > 512*1024 {
if proto.Size(stat) > 512*1024 {
Copy link
Member

Choose a reason for hiding this comment

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

This is meant to be file size. We also should probably increase the limit (in a different PR).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -148,10 +149,14 @@ func pruneCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command {
flags := cmd.Flags()
flags.BoolVarP(&options.all, "all", "a", false, "Include internal/frontend images")
flags.Var(&options.filter, "filter", `Provide filter values (e.g., "until=24h")`)
flags.Var(&options.keepStorage, "keep-storage", "Amount of disk space to keep for cache")
flags.Var(&options.minStorage, "min-storage", "Minimum amount of disk space to keep for cache")
Copy link
Member

Choose a reason for hiding this comment

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

This part needs updates based on moby/buildkit#5359

Not a blocker but need to make sure we don't ship this version.

func digestSliceFromPB(elems []string) []digest.Digest {
clone := make([]digest.Digest, len(elems))
for i, e := range elems {
clone[i] = digest.Digest(e)
Copy link
Member

Choose a reason for hiding this comment

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

Ideally all digest casts(when data comes from API) go through digest.Parse. There was a similar follow-up to buildkit PR.

@tonistiigi tonistiigi merged commit 1db8f67 into docker:master Oct 2, 2024
108 checks passed
@jsternberg jsternberg deleted the gogoproto-remove branch October 2, 2024 23:04
jsternberg added a commit to jsternberg/buildkit that referenced this pull request Oct 3, 2024
The relative paths option for protoc generators doesn't work well when
it comes to dependencies. This simplifies the code generation to avoid
using `go generate` and to use one global command for protoc generation.

This is similar to docker/buildx#2713 since the
same problems with code generation occur here too.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants