Add ENGINE column driven by label - #13959
Conversation
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The ENGINE column feature is clean and correct. The implementation:
- Correctly guards against nil Labels maps in the new
Engine()method — no panic risk for containers without labels - Only shows the ENGINE column when at least one container carries the
com.docker.compose.enginelabel - The
hasEnginedetection loop correctly reflects the filtered container set - Format string construction order (ENGINE before SIZE) is internally consistent
- New test covers the happy-path scenario
No bugs were found in the added code.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
glours
left a comment
There was a problem hiding this comment.
hasEngine scans the filtered container set (cmd/compose/ps.go), so column presence depends on which services you name. Say svc1 carries the com.docker.compose.engine label and svc2 doesn't:
compose ps→ ENGINE column shown (svc2gets an empty cell)compose ps svc2→ no ENGINE column, even thoughsvc2's row is identical to the one just showncompose ps svc1→ shown again
Same rows, different schema. That breaks table-parsing and diverges from docker ps, where columns are never data-gated.
As this is a very specific display, could we gate it on the coordinator context (the same context-metadata detection as the project-config work, living under internal/) instead of the data? Presence then stays stable across ps / ps <subset>.
Nit: api.EngineLabel (com.docker.compose.engine) collides by name with desktop.EngineLabel (com.docker.desktop.address), can we consider a more specific name?
cadb256 to
47e560e
Compare
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The ENGINE column feature is well-structured. The new internal/coordinator package correctly gates the feature on Docker context metadata, the label constant matches the documented name (com.docker.compose.engine), and error paths (HTTP timeouts, non-200 responses, missing coordinator) are handled. Test coverage is present for the new coordinator logic, the formatter, and compose ps.
No high- or medium-severity bugs were found in the changed code.
| assert.Assert(t, strings.Contains(out.String(), "moby"), out.String()) | ||
| }) | ||
|
|
||
| t.Run("engine column hidden when no label present", func(t *testing.T) { |
There was a problem hiding this comment.
| t.Run("engine column hidden when no label present", func(t *testing.T) { | |
| t.Run("engine column hidden when coordinateur disabled", func(t *testing.T) { |
47e560e to
f5f73b6
Compare
f5f73b6 to
01bb74d
Compare
Show an ENGINE column in `compose ps` default table output when the
com.docker.compose.engine label is present. Expose {{.Engine}} for custom
--format templates.
Rename api.EngineLabel to api.ContainerEngineLabel to avoid the
name collision with desktop.EngineLabel (com.docker.desktop.address).
Signed-off-by: Nick Sieger <nick@nicksieger.com>
01bb74d to
b4a1f61
Compare
|
Non-blocking, because compose is already heavily depending on labels to store state, but we should start looking if we could transition to using Annotations, especially for state that shouldn't be persisted (doing a // HostConfig the non-portable Config structure of a container.
// Here, "non-portable" means "dependent of the host we are running on".
// Portable information *should* appear in Config.
type HostConfig struct {
// Applicable to all platforms
Binds []string // List of volume bindings for this container
ContainerIDFile string // File (path) where the containerId is written
LogConfig LogConfig // Configuration of the logs for this container
NetworkMode NetworkMode // Network mode to use for the container
PortBindings network.PortMap // Port mapping between the exposed port (container) and the host
RestartPolicy RestartPolicy // Restart policy to be used for the container
AutoRemove bool // Automatically remove container when it exits
VolumeDriver string // Name of the volume driver used to mount volumes
VolumesFrom []string // List of volumes to take from other container
ConsoleSize [2]uint // Initial console size (height,width)
Annotations map[string]string `json:",omitempty"` // Arbitrary non-identifying metadata attached to container and provided to the runtimeWe may have to look for some parts w.r.t. filtering though, especially for the compose project the object is associated with (which, may not always be "runtime state", so maybe labels are more OK for that); for project we should definitely look if containerd namespaces would be a viable option (and add namespaces to other objects) |
|
@thaJeztah good point, I guess we could migrate compose to use annotations (labels were used in the original implementation as annotations were not available) => #14050 |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [docker/compose](https://github.com/docker/compose) | minor | `v5.4.0` → `v5.5.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>docker/compose (docker/compose)</summary> ### [`v5.5.0`](https://github.com/docker/compose/releases/tag/v5.5.0) [Compare Source](docker/compose@v5.4.0...v5.5.0) #### What's Changed > ℹ️ This release overhauls image digest reconciliation to prevent unnecessary container recreation.\ > Existing containers may be recreated the first time you run `compose up` after upgrading, as image digests are re-evaluated using the new logic. > > `compose pull` now honors `pull_policy` refresh windows (`daily`, `weekly`, `every_N`). ##### ✨ Improvements - New image digest reconciliation process by [@​glours](https://github.com/glours) & [@​ndeloof](https://github.com/ndeloof) [#​14011](docker/compose#14011) [#​14041](docker/compose#14041) ##### 🐛 Fixes - Fix(bridge): skip pulling default image references for build-only ser… by [@​ericwyles](https://github.com/ericwyles) in [#​14010](docker/compose#14010) - Fix(watch): stop pruning every dangling image of the project by [@​glours](https://github.com/glours) in [#​14012](docker/compose#14012) - Fix(config): resolve service environment when computing --hash by [@​glours](https://github.com/glours) in [#​14002](docker/compose#14002) - Fix(watch): skip unreadable directories instead of failing the watch by [@​Endika](https://github.com/Endika) in [#​13992](docker/compose#13992) - Fix: ignore one-off container events in up monitor by [@​brano-osif](https://github.com/brano-osif) in [#​14038](docker/compose#14038) - Fix(bridge): validate arguments of bridge subcommands by [@​glours](https://github.com/glours) in [#​14003](docker/compose#14003) - Fix(images): tolerate containers whose image record is gone by [@​ndeloof](https://github.com/ndeloof) in [#​14028](docker/compose#14028) ##### 🔧 Internal - Test: Set stop\_signal to SIGTERM in nginx-based services by [@​ricardobranco777](https://github.com/ricardobranco777) in [#​13881](docker/compose#13881) - Chore: inline needlessly extracted single-use helpers by [@​ndeloof](https://github.com/ndeloof) in [#​14048](docker/compose#14048) - Add ENGINE column driven by label by [@​nicksieger](https://github.com/nicksieger) in [#​13959](docker/compose#13959) ##### ⚙️ Dependencies - Build(deps): bump github.com/moby/moby/client from 0.5.0 to 0.5.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13999](docker/compose#13999) - Build(deps): bump github/codeql-action/upload-sarif from 4.37.3 to 4.37.4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14009](docker/compose#14009) - Build(deps): bump github/codeql-action/upload-sarif from 4.37.4 to 4.37.5 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14019](docker/compose#14019) - Build(deps): bump github.com/moby/buildkit from 0.32.1 to 0.32.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14033](docker/compose#14033) - Build(deps): bump github.com/docker/buildx from 0.36.0 to 0.36.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14034](docker/compose#14034) - Build(deps): bump docker/github-builder/.github/workflows/bake.yml from 1.15.0 to 1.16.0 in the docker-actions group by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14035](docker/compose#14035) - Build(deps): bump github.com/moby/go-archive from 0.3.2 to 0.3.3 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14043](docker/compose#14043) - Build(deps): bump github/codeql-action/upload-sarif from 4.37.5 to 4.37.6 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14022](docker/compose#14022) - Build(deps): bump github.com/docker/cli from 29.6.2+incompatible to 29.7.2+incompatible by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14042](docker/compose#14042) - Build(deps): bump google.golang.org/grpc from 1.82.1 to 1.83.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14008](docker/compose#14008) - Bump golang to version 1.26.6 by [@​glours](https://github.com/glours) in [#​14045](docker/compose#14045) #### New Contributors - [@​ericwyles](https://github.com/ericwyles) made their first contribution in [#​14010](docker/compose#14010) - [@​Endika](https://github.com/Endika) made their first contribution in [#​13992](docker/compose#13992) - [@​brano-osif](https://github.com/brano-osif) made their first contribution in [#​14038](docker/compose#14038) **Full Changelog**: <docker/compose@v5.4.0...v5.5.0> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yODguMCIsInVwZGF0ZWRJblZlciI6IjQzLjI4OC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6bWlub3IiXX0=-->
What I did
Show an ENGINE column in
compose psdefault table output when the com.docker.compose.engine label is present in any containers. Column is omitted otherwise. Expose {{.Engine}} for custom --format templates.Supports future multi-engine coordinators and workloads.
Related issue
(not mandatory) A picture of a cute animal, if possible in relation to what you did