Skip to content

Comments

daemon: define default (and maximum) API version#50436

Merged
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:daemon_separate_version
Jul 21, 2025
Merged

daemon: define default (and maximum) API version#50436
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:daemon_separate_version

Conversation

@thaJeztah
Copy link
Member

With the daemon and API migrating to separate modules, users of the daemon module may upgrade the API module to higher versions. Currently, the daemon uses the API's Default version. While the version of the API module is allowed to be updated (following SemVer), we should not allow the Daemon to support higher API versions than it was written for.

This patch introduces a DefaultAPIVersion in the daemon/config package that is used as default version of the API for the daemon to use.

- Human readable description for the release notes

Go SDK: daemon/config: add `DefaultAPIVersion` const, which defines the default (and maximum) API version supported by the daemon.

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

Comment on lines +59 to +63
// DefaultAPIVersion is the highest REST API version supported by the daemon.
//
// This version may be lower than the [api.DefaultVersion], which is the default
// (and highest supported) version of the api library module used.
DefaultAPIVersion = "1.52"
Copy link
Member Author

Choose a reason for hiding this comment

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

Possibly these should be moved to the Server package and/or injected to it, but we can move later if we see fit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we could move these into version.generated.go and then go generate them to avoid having to encode the version in multiple places?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I was considering having an integration tests to validate they're all the same versions (something that's testing how api + client + daemon integrate).

We have this code for the "version", which gets set at compile time, but for this one, we must commit the changes in source-control;

var (
GitCommit = "library-import"
Version = "library-import"
BuildTime = "library-import"
PlatformName = ""
ProductName = ""
DefaultProductLicense = ""
)

Copy link
Member Author

Choose a reason for hiding this comment

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

If we'd go for go generate, we'd have to look where to put that code (i.e., we don't want someone using the client module to run go generate and it picking up the version from the api module 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, go generate would just be a part of the "bump API version" action on the maintainer side.

Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed in the call; let's look at this in a follow-up.

(I agree it would be nice to have; the go generate can be used then to detect when versions are incorrect in CI)

With the daemon and API migrating to separate modules, users of the daemon
module may upgrade the API module to higher versions. Currently, the daemon
uses the API's Default version. While the version of the API module is
allowed to be updated (following SemVer), we should not allow the Daemon
to support higher API versions than it was written for.

This patch introduces a DefaultAPIVersion in the daemon/config package that is
used as default version of the API for the daemon to use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah requested a review from vvoland July 20, 2025 16:24
@thaJeztah thaJeztah merged commit 842b631 into moby:master Jul 21, 2025
223 of 225 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in go modules transition Jul 21, 2025
@thaJeztah thaJeztah deleted the daemon_separate_version branch July 21, 2025 15:07
@vvoland vvoland added kind/refactor PR's that refactor, or clean-up code area/go-sdk labels Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API area/daemon Core Engine area/go-sdk go-modules impact/changelog kind/refactor PR's that refactor, or clean-up code release-blocker PRs we want to block a release on status/2-code-review

Projects

Development

Successfully merging this pull request may close these issues.

3 participants