1237 Commits

Author SHA1 Message Date
Guillaume Lours
f266715dd0 add --provenance and --sbom flag to generated bake command line,
also add attestation per-service configuration to generated bake target

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-08-13 09:36:22 +02:00
Guillaume Lours
c2cb0aef6b only monitor attached services on up command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-08-08 17:27:08 +02:00
Guillaume Lours
bf6d7bf47e define pull and no_cache from either service or flags values when building with bake
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-08-05 13:52:43 +02:00
Sebastiaan van Stijn
fc66da06db pkg/compose: simplify getting auth-config key
Rewrite to remove the `github.com/docker/docker/registry` dependency,
which will not be included in the upcoming "api" and "client" modules,
and will not be a public package in the module used for the daemon itself.

1. don't call "/info" API endpoint to get default registry

The `IndexServerAddress` in the `/info` endpoint was added as part of the
initial Windows implementation of the engine. For legal reasons, Microsoft
Windows (and thus Docker images based on Windows) were not allowed to be
distributed through non-Microsoft infrastructure. As a temporary solution,
a dedicated "registry-win-tp3.docker.io" registry was created to serve
Windows images.

Using separate registries was not an ideal solution, and a more permanent
solution was created by introducing "foreign image layers" in the distribution
spec, after which the "registry-win-tp3.docker.io" ceased to exist, and
removed from the engine through docker/docker PR 21100.

However, the `ElectAuthServer` was left in place, quoting from that PR;

> make the client check which default registry the daemon uses is still
> more correct than leaving it up to the client, even if it won't technically
> matter after this PR. There may be some backward compatibility scenarios
> where `ElectAuthServer` [sic] is still helpful.

That comment was 10 Years ago, and the CLI stopped using this information,
as the default registry is not configurable, so in practice was a static
value. (see b4ca1c7368).

2. replace `ParseRepositoryInfo` and `GetAuthConfigKey` with local impl

The `ParseRepositoryInfo` function was originally implemented for use by
the daemon itself. It returns a `RepositoryInfo` struct that holds information
about the repository and the registry the repository can be found in.

As it was written for use by the daemon, it also was designed to be used
in combination with the daemon's configuration (such as mirrors, and
insecure registries). If no daemon configuration is present, which would
be the case when used in a CLI, it uses fallback logic as used in the daemon
to detect if the registry is running on a localhost / loopback address,
because such addresses are allowed to be "insecure" by default; this includes
resolving the IP-address of the host (if it's not an IP-address).

Unfortunately, these functions (and related types) were reused in the
CLI and many other places, which resulted in those types to be deeply
ingrained in interfaces and (external) code.

For compose; it was only used to get the "auth-config key" to use for
looking up auth information from the credentials store, which still
needs special handling for the "default" (docker hub) domain, which
unlike other image references doesn't use the hostname included in
the image reference for the actual registry (and key for storing
auth).

For those that want to follow along;

First, note that `GetAuthConfig` only requires a `registry.IndexInfo`, so not
the whole `RepositoryInfo` struct;
https://github.com/moby/moby/blob/v28.3.3/registry/types.go#L8-L24

From the `registry.IndexInfo` it only uses the `IsOfficial` and `Name` fields;
https://github.com/moby/moby/blob/v28.3.3/registry/config.go#L390-L395

But to get the `IndexInfo`, `ParseRepositoryInfo` is needed, which first
takes the image reference's "domain name" (e.g. `docker.io`);
https://github.com/moby/moby/blob/v28.3.3/registry/config.go#L421

This gets "normalized" for some cases where the `info.IndexServerAddress`
was incorrectly assumed to be the canonical domain for Docker Hub registry,
and which _does_ happen to also be accessible as a "v2" registry.
https://github.com/moby/moby/blob/v28.3.3/registry/config.go#L334-L341

After normalizing, it checks if it's a docker hub address ("docker.io"
after normalizing); Docker Hub is always required to use a secure
connection, so no detection happens, and the `Official` field is set
to indicate it's Docker Hub (this code path was already simplified
as historically it would try to find daemon configuration (or otherwise
use a default) for Mirror configuration;
https://github.com/moby/moby/blob/v28.3.3/registry/config.go#L420-L443

For non-Docker Hub registries, it also sets the name, and attempts
to detect if the registry is allowed to be "insecure";
https://github.com/moby/moby/blob/v28.3.3/registry/config.go#L435-L442

Which (as mentioned) involves parsing the address and, if needed, resolving
the hostname
https://github.com/moby/moby/blob/v28.3.3/registry/config.go#L445-L481

As `Insecure` is not used for looking up the auth-config key, all of the
above can be reduced to;

- Is the hostname obtained from the image reference "docker.io" (after normalizing)?
- If so, use the special `https://index.docker.io/v1/` as auth-config key (another horrible remnant)
- Otherwise use the hostname obtained from the image reference as-is

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 10:08:23 +02:00
Sebastiaan van Stijn
909211dd61 use cli-plugins/metadata package
The metadata types and consts where moved to a separate package,
so update the code to use the new location instead of the aliases
provided.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 10:01:53 +02:00
Nicolas De Loof
2c12ad19db use log API for containers we didn't attached to
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-29 14:23:24 +02:00
Guillaume Lours
038ea8441a apply BUILDKIT_PROGRESS value when building with bake
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-07-29 11:45:33 +02:00
Guillaume Lours
9e98e6101e add missing _MODEL suffix to model variable pass to dependent services of a model
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-07-29 09:40:46 +02:00
keitosuwahara
52f04229c0 fixed lint error
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
2025-07-28 10:07:03 +02:00
keitosuwahara
28895d0322 fix lint error
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
2025-07-28 10:07:03 +02:00
keitosuwahara
a926f7d717 Elimneted magic string
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
2025-07-28 10:07:03 +02:00
Nicolas De Loof
fe046915eb buildkit require os.Stdout to access the raw terminal
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-28 09:25:35 +02:00
keitosuwahara
adbd61e5d6 fixed lint error
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
2025-07-27 19:36:40 +02:00
keitosuwahara
e37ac04329 deleted useless comment
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
2025-07-27 19:36:40 +02:00
keitosuwahara
cab2c2a44e Refactoring of redundant condition checks
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
2025-07-27 19:36:40 +02:00
keitosuwahara
1946de598d improved lint error
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
2025-07-27 15:12:38 +02:00
keitosuwahara
8e29a138aa improved test
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
2025-07-27 15:12:38 +02:00
keitosuwahara
3c8da0afee Add test of json.go
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
2025-07-27 15:12:38 +02:00
keitosuwahara
1b12c867c5 add Streams Comment
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
2025-07-27 14:57:43 +02:00
Guillaume Lours
f6ddd6ae88 use output registry when push true and load to docker store if not
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-07-23 15:49:19 +02:00
Nicolas De Loof
fd954f266c show build progress during watch rebuild
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-23 13:57:46 +02:00
Nicolas De Loof
d62e21025c forward git command error to user
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-23 12:10:25 +02:00
Guillaume Lours
4d47da6dc2 do not pass user id on Windows system as engine is not able to handel it
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-07-22 12:07:58 +02:00
Nicolas De Loof
8f91793fb5 introduce build.provenance and sbom support
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-21 17:07:41 +02:00
Sebastiaan van Stijn
1d2223fb23 pkg/compose: use local copy of pkg/system.IsAbs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 16:02:52 +02:00
Sebastiaan van Stijn
d4f6000712 remove import aliases for containerd/errdefs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:51:39 +02:00
Sebastiaan van Stijn
c50d16cd78 pkg/compose: remove uses of moby/errdefs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:51:39 +02:00
Nicolas De Loof
3875e13fad simpler stop UI
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-21 10:31:50 +02:00
Nicolas De Loof
c89f30170d force plain displaymode if stdout isn't a terminal
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-21 10:19:58 +02:00
Nicolas De Loof
41a9b91887 warn user COMPOSE_BAKE=false is deprecated
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-21 10:18:08 +02:00
Nicolas De Loof
f35d2cfb3b monitor must watch events even when context is cancelled
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-17 15:08:35 +02:00
Nicolas De Loof
17ba6c7188 abstract model-cli commands execution with a model (pseudo) API
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-16 17:34:59 +02:00
Nicolas De Loof
1c37f1abb6 use logs API with Since to collect the very first logs after restart
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-16 17:24:11 +02:00
Nicolas De Loof
485b6200ee (refactoring) introduce monitor to manage containers events and application termination
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-16 17:24:11 +02:00
Guillaume Lours
6b9667401a fix the helm bridge e2e tests after the latest update of the templates
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-07-16 16:04:52 +02:00
Arthur Bols
9a1e589ce8 Fix report image name in bake result
Signed-off-by: Arthur Bols <arthur@bols.dev>
2025-07-16 08:59:12 +02:00
Guillaume Lours
5e147e852e add default compose labels to images built from bake
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-07-16 07:35:07 +02:00
Nicolas De Loof
29308cb97e keep containers attached on stop to capture termination logs
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-15 11:26:44 +02:00
Guillaume Lours
0b0242d0ac add dry-run support to bake build
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-07-15 10:52:03 +02:00
atagtm
f7ee9c8a0c feat(os): add FreeBSD support
Signed-off-by: atagtm <donisos1146@gmail.com>
2025-07-11 10:44:45 +02:00
MohammadHasan Akbari
35efa97b7d feat: add since & until flags to events command
Signed-off-by: MohammadHasan Akbari <jarqvi.jarqvi@gmail.com>
Co-authored-by: Amin Ehterami <A.Ehterami@proton.me>
2025-07-09 10:08:33 +02:00
Guillaume Lours
4bbc6c609f add USER_AGENT variable to cmd when shellouting
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-07-08 11:12:40 +02:00
Nicolas De Loof
69f1430a49 resolve Dockerfile symlink but file name
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-08 10:06:34 +02:00
Nicolas De Loof
7cf7c6414f build resolves enabled service after project has been loaded
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-07 16:43:42 +02:00
Guillaume Lours
c626befee1 fix the way we're checking if the provider metadata are empty or not
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-07-04 12:41:37 +02:00
Nicolas De Loof
60ee6adcd2 a single place for shell-out command setup
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-04 11:17:11 +02:00
Guillaume Lours
f42374bb18 add a Done event to model progress display
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-07-02 11:25:07 +02:00
Nicolas De Loof
6fa173124a (reactoring) avoid a global variable by introducing logConsumer decorator
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-01 12:29:05 +02:00
Sebastiaan van Stijn
2c69fc3d4d pkg/compose: remove redundant uses of strslice.StrSlice
The strslice.StrSlice type is a string-slice with a custom JSON Unmarshal
function to provide backward-compatibility with older API requests (see
[moby@17d6f00] and [moby@ea4a067]).

Given that the type is assigned implicitly through the fields on HostConfig,
we can just use a regular []string instead.

[moby@17d6f00]: 17d6f00ec2
[moby@ea4a067]: ea4a06740b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 10:49:29 +02:00
Nicolas De Loof
317ebcd3b0 implement model_variable
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-06-30 21:50:39 +02:00