44 Commits
Author SHA1 Message Date
Alano Terblanche 171f9d0767 docs(registry): trim comments
Shorten the doc comments added for the Docker Desktop credentials provider to what the code does not already say, and drop them from the tests.

Signed-off-by: Alano Terblanche <[email protected]>
2026-10-07 14:24:28 +02:00
Alano Terblanche fd4dae8351 feat(registry): use the Docker Desktop Hub session for Docker Hub credentials
Docker Hub credentials are now read first from the session of the account signed in to Docker Desktop, through the Docker Desktop secrets engine (github.com/docker/secrets-engine/client), and from the Docker CLI config file and its credential helpers otherwise. Other registries keep using the config file only.

The OAuth access token is passed as the password of the signed-in account, never as an IdentityToken, which containerd sends as a refresh token. It flows unchanged to the engine in X-Registry-Auth and through the OCI resolver as an OAuth password grant.

Compose falls back to the config file when Desktop is not running, nobody is signed in, the session is expired or about to expire, or the lookup fails (the last logged as a warning). The session is shared process wide, cached until shortly before it expires, and an unusable session is not asked for again. Lookups are bounded by a 5s timeout, as the SDK applies none by default.

Used by pull, push, publish, config --resolve-image-digests, oci:// remote resources and dry-run. The classic builder and use_api_socket keep config file credentials, as a short-lived token copied into a container would go stale.

Signed-off-by: Alano Terblanche <[email protected]>
2026-10-07 14:24:28 +02:00
Sebastiaan van Stijn 063ef45da1 golangci-lint: enable perfsprint linter
Signed-off-by: Sebastiaan van Stijn <[email protected]>
2026-09-10 10:25:34 +02:00
Nicolas De LoofandClaude Fable 5 d6e26f427f refactor: split ociRemoteLoader.Load pull and index resolution
Load (cognitive complexity 48) mixed the enable/offline guards with
the artifact pull, the cache check and the image-index indirection.
The pull path moves to pullComposeArtifact and the index-to-manifest
resolution to resolveComposeManifest. Load reads as: guards, cache
lookup, pull on miss.

No behavior change, including the last-matching-manifest-wins loop
and the silent cache hit on a non-NotExist stat error.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Nicolas De Loof <[email protected]>
2026-08-18 13:37:48 +02:00
Nicolas De LoofandClaude Fable 5 2340121f0e lint: replace gocyclo with gocognit
Cognitive complexity (gocognit, threshold 30 — the linter default) fits
this codebase better than raw cyclomatic complexity: it barely charges
guard clauses and early returns, and penalizes nesting instead. As a
result 8 of the 21 //nolint:gocyclo suppressions become unnecessary,
while deeply nested functions gocyclo never flagged are now caught.

The 19 functions still above the threshold keep a suppression, each
marked FIXME to complete the migration by restructuring them.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Nicolas De Loof <[email protected]>
2026-08-18 10:42:37 +02:00
Guillaume Lours cda9f2044f fix(oci): fetch artifact layers from blobs endpoint, not via Resolve
Pulling an oci:// resource resolved each layer digest through the
registry manifests endpoint, which answers 500 when the digest points
to a non-manifest blob. containerd v2.3.0+ (pulled in by buildx v0.36
and buildkit v0.32) no longer falls back to the blobs endpoint unless
manifests returned 404, so publish/pull of compose artifacts broke.
Fetch layers directly with the descriptors already listed in the
manifest instead of resolving them again.

Signed-off-by: Guillaume Lours <[email protected]>
2026-08-03 14:56:34 +02:00
solunolab be0c713ca5 chore: fix some comments to improve readability
Signed-off-by: solunolab <[email protected]>
2026-06-09 11:45:13 +02:00
Guillaume Lours 66c21c3b6c fix: route OCI artifact pulls through Docker Desktop HTTP proxy
The compose process performs OCI artifact fetches in-process via
containerd's docker resolver, whose default transport only honors
HTTP_PROXY/HTTPS_PROXY/NO_PROXY env vars. Users behind PAC-only
corporate proxies hit i/o timeouts on `oci://` includes and on
`compose publish`.

When Docker Desktop is the active engine and exposes httpproxy.sock,
route the resolver through it (PAC-aware). Falls back to the default
transport when DD is unavailable or the socket is missing. Modeled on
docker/mcp-gateway PR #354.

Signed-off-by: Guillaume Lours <[email protected]>
2026-05-18 10:53:23 +02:00
Sebastiaan van Stijn dc66e6bad1 golangci-lint: use gci formatter instead of goimports
Most files already grouped imports into "stdlib -> other -> local",
but some files didn't. The gci formatter is similar to goimports, but
has better options to make sure imports are grouped in the expected
order (and to make sure no additional groups are present).

This formatter has a 'fix' function, so code can be re-formatted auto-
matically;

    golangci-lint run -v --fix

Signed-off-by: Sebastiaan van Stijn <[email protected]>
2025-12-01 12:21:50 +01:00
Nicolas De Loof 2b4543935c next release will be major version v5.x
Signed-off-by: Nicolas De Loof <[email protected]>
2025-11-13 09:32:43 +01:00
Nicolas De Loof 7eb5adeef6 introduce --insecure-registry, reserved for testing purpose
Signed-off-by: Nicolas De Loof <[email protected]>
2025-11-06 16:17:21 +01:00
Suleiman Dibirov 0d396bbacb fix(git): Add validation for Git subdirectory paths to prevent traversal
Signed-off-by: Suleiman Dibirov <[email protected]>
2025-10-30 10:08:29 +01:00
Nicolas De Loof e59150baa8 fix OCI compose override support
Signed-off-by: Nicolas De Loof <[email protected]>
2025-10-23 12:04:37 +02:00
Nicolas De Loof 6a90742ef2 Test to check writeComposeFile detects invalid OCI artifact
Signed-off-by: Nicolas De Loof <[email protected]>
2025-10-22 20:09:32 +02:00
Nicolas De Loof 6007d4c7e7 publish env_file references as opaque hash to prevent paths conflicts
Signed-off-by: Nicolas De Loof <[email protected]>
2025-10-22 19:32:16 +02:00
Guillaume Lours 69bcb962bf Enforce compose files from OCI artifact all get into the same target (cache) folder
Signed-off-by: Guillaume Lours <[email protected]>
Signed-off-by: Nicolas De Loof <[email protected]>
2025-10-22 19:32:16 +02:00
Nicolas De Loof 07602f2070 publish Compose application as compose.yaml + images
Signed-off-by: Nicolas De Loof <[email protected]>
2025-10-03 10:59:57 +02:00
Nicolas De Loof fa08127456 use containerd client for OCI operations
Signed-off-by: Nicolas De Loof <[email protected]>
2025-09-30 12:03:46 +02:00
Sebastiaan van Stijn b33ecf65e8 go.mod: bump buildx v0.28.0-rc2, buildkit v0.24.0-rc2
Signed-off-by: Sebastiaan van Stijn <[email protected]>
2025-09-02 07:28:06 +02:00
Sebastiaan van Stijn 1d52012b82 go.mod: bump buildkit v0.24.0-rc1, buildx v0.28.0-rc1
Signed-off-by: Sebastiaan van Stijn <[email protected]>
2025-08-29 08:16:23 +02:00
Nicolas De Loof d62e21025c forward git command error to user
Signed-off-by: Nicolas De Loof <[email protected]>
2025-07-23 12:10:25 +02:00
atagtm f7ee9c8a0c feat(os): add FreeBSD support
Signed-off-by: atagtm <[email protected]>
2025-07-11 10:44:45 +02:00
Nicolas De Loof ee33143026 capture git fetch output when debug output is enabled
Signed-off-by: Nicolas De Loof <[email protected]>
2025-04-08 12:03:41 +02:00
Nicolas De Loof 66a47169d5 Publish compose file with required siblings used by extends
Signed-off-by: Nicolas De Loof <[email protected]>
2025-03-07 13:58:10 +01:00
Guillaume Lours b6c8a2b9fc display the location of OCI or GIT Compose stack download
Signed-off-by: Guillaume Lours <[email protected]>
2025-03-03 22:09:06 +01:00
Guillaume Lours 840288895e add --with-env flag to publish command
this flag allow publishing env variables in the Compose OCI artifact

Signed-off-by: Guillaume Lours <[email protected]>
2025-01-29 15:45:00 +01:00
Guillaume Lours 26064d4b60 allow usage of -f flag with oci Compose artifact
Signed-off-by: Guillaume Lours <[email protected]>
2024-10-25 17:36:04 +02:00
Kirill A. Korinsky fb25e88a03 Backport OpenBSD patches
Here a trivial patch whcih I've used inside OpenBSD port to build it

Signed-off-by: Kirill A. Korinsky <[email protected]>
2024-05-22 11:35:37 +02:00
Nicolas De Loof eb4249ece4 bump compose-go to v2.0.0-rc.2
Signed-off-by: Nicolas De Loof <[email protected]>
2024-01-22 12:27:38 +01:00
Nicolas De Loof cda04f288e adopt compose-go/v2
Signed-off-by: Nicolas De Loof <[email protected]>
2023-12-05 18:54:31 +01:00
Nicolas De Loof d646d757a2 lint
Signed-off-by: Nicolas De Loof <[email protected]>
2023-11-02 11:16:35 +01:00
Nicolas De Loof 71237ef62b do not resolve cache dir until remote resource is in use
Signed-off-by: Nicolas De Loof <[email protected]>
2023-11-02 11:16:35 +01:00
Nicolas De Loof 0d905a896d add a copyright notice with original author
Signed-off-by: Nicolas De Loof <[email protected]>
2023-11-02 11:16:35 +01:00
Nicolas De Loof 5e3d8f671d re-implement cache folder detection
Signed-off-by: Nicolas De Loof <[email protected]>
2023-11-02 11:16:35 +01:00
Guillaume Lours 3d0207ebc8 remove uncessary return value of pullComposeFiles function
Signed-off-by: Guillaume Lours <[email protected]>
2023-10-18 12:42:11 +02:00
Nicolas De Loof 599e4b242a extract method to reduce cyclomatic complexity
Signed-off-by: Nicolas De Loof <[email protected]>
2023-09-29 10:18:11 +02:00
Nicolas De Loof fe8c2780c8 warn user remote resource is disabled
Signed-off-by: Nicolas De Loof <[email protected]>
2023-09-29 09:30:38 +02:00
Matthieu MOREL 4f694919ff deps: remove deprecated github.com/pkg/errors
Signed-off-by: Matthieu MOREL <[email protected]>
2023-09-29 06:28:58 +02:00
Bjorn Neergaard a6b7d78575 pkg/remote/oci: check artifactType instead of config.mediaType
Signed-off-by: Bjorn Neergaard <[email protected]>
2023-09-29 05:27:14 +02:00
Bjorn Neergaard 991901f2ef pkg/remote/oci: refer to the manifest as manifest
Signed-off-by: Bjorn Neergaard <[email protected]>
2023-09-29 05:27:14 +02:00
Nicolas De Loof 5ca35c88be implement publish
Signed-off-by: Nicolas De Loof <[email protected]>
2023-09-20 18:14:58 +02:00
Nicolas De Loof e0f39ebbef pull OCI remote resource
Signed-off-by: Nicolas De Loof <[email protected]>
2023-09-07 07:27:32 +02:00
Milas Bowman 19f66918cc watch: only allow a single instance per-project
This is a good place to start introducing (local) exclusivity
to Compose. Now, when `alpha watch` launches, it will check for
the existence of a PID file in the user XDG runtime directory,
and create one if the existing one is stale or does not exist.
If the PID file exists and is valid, an error is returned and
Compose exits.

A slight tweak to the experimental remote Git loader has been
made to use the XDG package for consistency.

Signed-off-by: Milas Bowman <[email protected]>
2023-08-25 15:49:28 +02:00
Nicolas De loof dd34f7a22b include: add experimental support for Git resources (#10811)
Requires setting `COMPOSE_EXPERIMENTAL_GIT_REMOTE=1`.

Signed-off-by: Nicolas De Loof <[email protected]>
2023-08-18 09:16:45 -04:00