Skip to content

Update and validation of generated files#44697

Merged
thaJeztah merged 5 commits intomoby:masterfrom
crazy-max:generate-files
May 29, 2023
Merged

Update and validation of generated files#44697
thaJeztah merged 5 commits intomoby:masterfrom
crazy-max:generate-files

Conversation

@crazy-max
Copy link
Member

@crazy-max crazy-max commented Dec 26, 2022

fixes #40176

- What I did

Adds a Dockerfile and Make targets to update and validate generated files via go:generate (proto, seccomp default profile)

- How I did it

Needed some changes in proto definitions, specially ones for libnetwork pkg that were not updated after being moved to this repo.

I use a dedicated Dockerfile as the main one is quite huge.

- How to verify it

$ make generate-files
$ make validate-generate-files

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@crazy-max crazy-max force-pushed the generate-files branch 2 times, most recently from cc61c26 to 52430e3 Compare January 1, 2023 17:40
ingressProxyTbl = make(map[string]io.Closer)
portConfigMu sync.Mutex
portConfigTbl = make(map[PortConfig]int)
portConfigTbl = make(map[*PortConfig]int)
Copy link
Contributor

Choose a reason for hiding this comment

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

This changes the map keys from matching by-value (i.e. the (name, protocol, target_port, published_port) tuple) to matching by reference identity. PortConfig{} == PortConfig{} but &PortConfig{} != &PortConfig{}. The by-value behaviour is clearly the intended one, so this change will break things. And annoyingly there isn't any guarantee that protobuf serialization is deterministic so that wouldn't work either. While there may be tuning knobs in gogo protobuf to stop it from emitting the extra XXX_ fields in PortConfig, that'd be only a stopgap measure as gogo protobuf is officially deprecated. Unfortunately, the only forward-compatible solution I can see is to define a parallel struct type by hand for use as map keys.

Copy link
Contributor

@corhere corhere left a comment

Choose a reason for hiding this comment

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

Nice find with gogofaster! We can figure out a future-proof solution later, when we tackle replacing gogo protobuf with something maintained.

@crazy-max crazy-max marked this pull request as ready for review January 10, 2023 11:50
crazy-max added 5 commits May 29, 2023 03:13
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Adds a Dockerfile and make targets to update and validate
generated files (proto, seccomp default profile)

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
gogofaster is identical as gogofast but removes XXX_unrecognized

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

let's bring this one in first, in case we still need the updated builder/remotecontext/tarsum.pb.go for whatever reason before we remove it.

Copy link
Member

Choose a reason for hiding this comment

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

nit: for other Dockerfiles in this repository, we use Dockerfile.<something> as convention; should we stick to a single convention?

@thaJeztah thaJeztah added this to the 25.0.0 milestone May 29, 2023
@thaJeztah thaJeztah merged commit 3a64315 into moby:master May 29, 2023
@crazy-max crazy-max deleted the generate-files branch May 29, 2023 15:18
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.

Add make target (and verify step) to regenerate protobufs

4 participants