client: set default user-agent based on module version#52167
client: set default user-agent based on module version#52167thaJeztah merged 2 commits intomoby:masterfrom
Conversation
f02e80b to
a73ae09
Compare
| // The returned value is intended for display purposes (e.g., in a default | ||
| // User-Agent), not for version comparison. | ||
| // | ||
| // [module.PseudoVersionBase]: https://pkg.go.dev/golang.org/x/mod/module@PseudoVersionBase |
There was a problem hiding this comment.
There was a problem hiding this comment.
Dang! Fat-fingered typing the URL; @ -> # - I wanted to make it a versioned URL let me fix.
There was a problem hiding this comment.
Fixed; also added a link to the Pseudo-version format; https://cs.opensource.google/go/x/mod/+/refs/tags/v0.34.0:module/pseudo.go;l=5-33
| // User-Agent), not for version comparison. | ||
| // | ||
| // [module.PseudoVersionBase]: https://pkg.go.dev/golang.org/x/mod/module@PseudoVersionBase | ||
| // [mod.Version]: https://pkg.go.dev/github.com/moby/moby/[email protected]/daemon/internal/builder-next/worker/mod#Version |
There was a problem hiding this comment.
Hmm wait why is it in builder-next? 🤔
Also, should we use the client or moby/moby module version?
There was a problem hiding this comment.
For this one, we want to use the client version; the goal here is that someone using the client would get a default set based on the module they use;
import "github.com/moby/moby/client"
...
client.NewFor the builder-next one; I have a branch (to be updated with fixes) to move it to daemon/internal so that we can use it in other places in the daemon (e.g. to include the Moby module version in docker info or docker version; #52170
Before this change, the client would use Go's default (`Go-http-client/1.1`)
user-agent if nothing was configured; this default User-Agent is known to
be blocked by various services, so users should always opt for setting an
explicit User-Agent, but for situations where it's not set, we now set a
default based on the module version, falling back to `v0.0.0+unknown` when
failing;
moby-client/v0.0.0+unknown linux/arm64
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
|
Rebased; this should be good for review again |
client: set default user-agent based on module version
Before this change, the client would use Go's default (
Go-http-client/1.1)user-agent if nothing was configured; this default User-Agent is known to
be blocked by various services, so users should always opt for setting an
explicit User-Agent, but for situations where it's not set, we now set a
default based on the module version, falling back to
v0.0.0+unknownwhenfailing;
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)