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

Move swarmd into its own Go module #3170

Merged
merged 4 commits into from Feb 26, 2024
Merged

Conversation

corhere
Copy link
Contributor

@corhere corhere commented Feb 23, 2024

The dockerapi executor has a dependency on the Docker API client, making it one of the primary reasons why Swarmkit depends on github.com/docker/docker. But it is only used by swarmd. Move the swarmd commands and the dockerapi executor into a separate Go module to help break the dependency cycle between github.com/docker/docker and github.com/moby/swarmkit/v2.

- What I did
Moved the swarmd commands (cmd/swarmd, cmd/swarmctl, cmd/swarm-rafttool, cmd/external-ca-example) and agent/exec/dockerapi into a dedicated subtree and made that subtree into its own Go module.

- How I did it
Very tediously.

- How to test it

- Description for the changelog

Signed-off-by: Cory Snider <csnider@mirantis.com>
The Docker API executor is one of the only importers of
github.com/docker/docker and is only used by swarmd. Move it under the
swarmd package tree in preparation for turning swarmd into its own Go
module.

Signed-off-by: Cory Snider <csnider@mirantis.com>
@dperny
Copy link
Collaborator

dperny commented Feb 23, 2024

Did not know you could do something like this, but it wraps things up neatly.

@dperny
Copy link
Collaborator

dperny commented Feb 23, 2024

Makefile should still build swarmd, some way or another, mostly because it's a very quick way of determining whether swarmkit as a whole actually builds. Though I guess running the tests has the same effect...

Signed-off-by: Cory Snider <csnider@mirantis.com>
@corhere
Copy link
Contributor Author

corhere commented Feb 23, 2024

I've updated the make DOCKER_SWARMKIT_USE_CONTAINER=1 lint target to also lint the swarmd module packages, which (like go vet) also asserts that the packages can build. I've also ensured that the swarmd tests are run (without collecting test coverage) in CI.

Make sure that swarmd does not bit-rot by building and testing it
against the local swarmkit module sources instead of whichever version
is listed in go.mod. This does risk us failing to notice when bumping
the swarmkit requirement becomes necessary, but we do not expect any
third parties to import packages from the swarmd module. And if anyone
does, they could always work around our oversight by adding a
requirement on a newer Swarmkit to their project.

Signed-off-by: Cory Snider <csnider@mirantis.com>
@codecov-commenter
Copy link

Codecov Report

Merging #3170 (1c77ee6) into master (9afd813) will decrease coverage by 4.33%.
Report is 46 commits behind head on master.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3170      +/-   ##
==========================================
- Coverage   61.75%   57.42%   -4.33%     
==========================================
  Files         155      149       -6     
  Lines       31143    31330     +187     
==========================================
- Hits        19232    17991    -1241     
- Misses      10371    11937    +1566     
+ Partials     1540     1402     -138     

@dperny dperny merged commit 0ff015c into moby:master Feb 26, 2024
9 checks passed
@corhere corhere deleted the swarmd-module branch February 26, 2024 19:00
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.

None yet

3 participants