Skip to content

WIP: migrate to moby modules #13078

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Jul 21, 2025

@thaJeztah thaJeztah requested a review from a team as a code owner July 21, 2025 18:51
@thaJeztah thaJeztah requested review from ndeloof and glours July 21, 2025 18:51
@thaJeztah thaJeztah marked this pull request as draft July 21, 2025 18:51
@thaJeztah thaJeztah changed the title Bump moby cli WIP: migrate to moby modules Jul 21, 2025
@thaJeztah thaJeztah force-pushed the bump_moby_cli branch 2 times, most recently from a5b199b to 73bb946 Compare July 21, 2025 18:55
@ndeloof
Copy link
Contributor

ndeloof commented Jul 21, 2025

Nice to see moby API as a dedicated module, so we don't get transitive dependencies from engine inside Compose ! ❤️

@@ -23,9 +23,9 @@ import (

"github.com/distribution/reference"
"github.com/docker/cli/cli/command"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/pkg/stringid"
stringid "github.com/docker/cli/cli/command/formatter"
Copy link
Member Author

Choose a reason for hiding this comment

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

Still some places where stringid is used (will open a PR to remove one)

@@ -0,0 +1,89 @@
// Package urlutil provides helper function to check if a given build-context
Copy link
Member Author

Choose a reason for hiding this comment

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

Added this fork temporarily; didn't realise compose itself also uses it (not only through cli); the CLI fork is "internal", so probably needs to made public, or we keep a fork here 😞

@thaJeztah
Copy link
Member Author

Remaining uses of docker/docker;

tree -d vendor/github.com/docker/docker
vendor/github.com/docker/docker
├── internal
│   └── lazyregexp
├── pkg
│   ├── jsonmessage
│   ├── namesgenerator
│   ├── pidfile
│   ├── process
│   ├── progress
│   ├── stdcopy
│   ├── streamformatter
│   └── stringid
└── registry

13 directories

@thaJeztah
Copy link
Member Author

Build failure looks like it may be an incompatible change in buildx itself?

 > [build 1/1] RUN --mount=type=bind,target=.     --mount=type=cache,target=/root/.cache     --mount=type=cache,target=/go/pkg/mod     --mount=type=bind,from=osxcross,src=/osxsdk,target=/xx-sdk     xx-go --wrap &&     if [ "$(xx-info os)" == "darwin" ]; then export CGO_ENABLED=1; fi &&     make build GO_BUILDTAGS="e2e" DESTDIR=/out &&     xx-verify --static /out/docker-compose:
1.027 GO111MODULE=on go build  -trimpath -tags "e2e" -ldflags "-w -X github.com/docker/compose/v2/internal.Version=fa50b46" -o "/out/docker-compose" ./cmd
38.90 # github.com/docker/buildx/build
38.90 /go/pkg/mod/github.com/tha!jeztah/[email protected]/build/provenance.go:135:16: pred1.ConvertToSLSA02 undefined (type *"github.com/moby/buildkit/solver/llbsolver/provenance/types".ProvenancePredicateSLSA1 has no field or method ConvertToSLSA02)
67.83 make: *** [Makefile:61: build] Error 1
38.90 /go/pkg/mod/github.com/tha!jeztah/[email protected]/build/provenance.go:135:16: pred1.ConvertToSLSA02 undefined (type 

@thaJeztah
Copy link
Member Author

OK, it's because buildx depends on an unreleased version of BuildKit, so go modules considers it to be older than the latest release and won't update; https://github.com/docker/buildx/blob/3f4bf829d8c5b92a8f670609417d9aa4c0b6be98/go.mod#L32

github.com/moby/buildkit v0.23.0-rc1.0.20250618182037-9b91d20367db // master

@thaJeztah thaJeztah force-pushed the bump_moby_cli branch 2 times, most recently from 83ca48f to 13827c4 Compare July 21, 2025 19:20
@ndeloof
Copy link
Contributor

ndeloof commented Jul 22, 2025

  • jsonmessage
    this one should be part of the API, don't you think ?

@thaJeztah
Copy link
Member Author

Yes, or at least the type; the utilities could be "client" - those packages are messy.

Also looking at things that are in the api, but shouldn't (api/types/plugins/logdriver)

@thaJeztah
Copy link
Member Author

Also included a (WIP) branch for docker/cli#6202

Before/After;

Before:

tree -d vendor/github.com/docker/cli
vendor/github.com/docker/cli
├── cli
│   ├── command
│   │   ├── completion
│   │   ├── container
│   │   ├── formatter
│   │   │   └── tabwriter
│   │   ├── image
│   │   │   └── build
│   │   │       └── internal
│   │   │           ├── git
│   │   │           └── urlutil
│   │   └── inspect
│   ├── compose
│   │   ├── interpolation
│   │   ├── loader
│   │   ├── schema
│   │   │   └── data
│   │   ├── template
│   │   └── types
│   ├── config
│   │   ├── configfile
│   │   ├── credentials
│   │   ├── memorystore
│   │   └── types
│   ├── connhelper
│   │   ├── commandconn
│   │   ├── internal
│   │   │   └── syntax
│   │   └── ssh
│   ├── context
│   │   ├── docker
│   │   └── store
│   ├── debug
│   ├── flags
│   ├── hints
│   ├── streams
│   ├── trust
│   └── version
├── cli-plugins
│   ├── hooks
│   ├── manager
│   ├── metadata
│   ├── plugin
│   └── socket
├── internal
│   ├── jsonstream
│   ├── lazyregexp
│   ├── prompt
│   └── tui
├── opts
│   └── swarmopts
├── pkg
│   └── kvfile
└── templates

55 directories

After:

tree -d vendor/github.com/docker/cli
vendor/github.com/docker/cli
├── cli
│   ├── command
│   │   ├── completion
│   │   ├── container
│   │   ├── formatter
│   │   │   └── tabwriter
│   │   ├── image
│   │   │   └── build
│   │   │       └── internal
│   │   │           ├── git
│   │   │           └── urlutil
│   │   └── inspect
│   ├── config
│   │   ├── configfile
│   │   ├── credentials
│   │   ├── memorystore
│   │   └── types
│   ├── connhelper
│   │   ├── commandconn
│   │   ├── internal
│   │   │   └── syntax
│   │   └── ssh
│   ├── context
│   │   ├── docker
│   │   └── store
│   ├── debug
│   ├── flags
│   ├── hints
│   ├── streams
│   ├── trust
│   └── version
├── cli-plugins
│   ├── hooks
│   ├── manager
│   ├── metadata
│   ├── plugin
│   └── socket
├── internal
│   ├── jsonstream
│   ├── lazyregexp
│   ├── prompt
│   ├── tui
│   └── volumespec
├── opts
├── pkg
│   └── kvfile
└── templates

48 directories

@thaJeztah thaJeztah force-pushed the bump_moby_cli branch 3 times, most recently from d2146d4 to 3a7124d Compare July 24, 2025 09:24
@thaJeztah thaJeztah force-pushed the bump_moby_cli branch 3 times, most recently from 3b1ec4c to 6cd56af Compare August 5, 2025 22:51
@thaJeztah
Copy link
Member Author

Down to two packages; both possibly candidates for github.com/moby/sys;

tree -d vendor/github.com/docker/docker
vendor/github.com/docker/docker
└── pkg
    ├── pidfile
    └── process

4 directories

CLI still needs sorting out;

tree -d vendor/github.com/docker/cli
vendor/github.com/docker/cli
├── cli
│   ├── command
│   │   ├── completion
│   │   ├── container
│   │   ├── formatter
│   │   │   └── tabwriter
│   │   ├── image
│   │   │   └── build
│   │   │       └── internal
│   │   │           ├── git
│   │   │           └── urlutil
│   │   ├── inspect
│   │   └── system
│   │       └── pruner
│   ├── config
│   │   ├── configfile
│   │   ├── credentials
│   │   ├── memorystore
│   │   └── types
│   ├── connhelper
│   │   ├── commandconn
│   │   ├── internal
│   │   │   └── syntax
│   │   └── ssh
│   ├── context
│   │   ├── docker
│   │   └── store
│   ├── debug
│   ├── flags
│   ├── hints
│   ├── streams
│   ├── trust
│   └── version
├── cli-plugins
│   ├── hooks
│   ├── manager
│   ├── metadata
│   ├── plugin
│   └── socket
├── internal
│   ├── jsonstream
│   ├── lazyregexp
│   ├── prompt
│   ├── registry
│   ├── tui
│   └── volumespec
├── opts
├── pkg
│   └── kvfile
└── templates

51 directories

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.

2 participants