Commit Graph

5519 Commits

Author SHA1 Message Date
Nicolas De Loof
5ef495c898 removed unecessary check
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-12 08:34:29 +01:00
Nicolas De Loof
9de7e2a388 SDK docs
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-10 16:15:36 +01:00
Jonty
dc90c4e44d Grammatical fix
Signed-off-by: Jonty <jontyleslie@gmail.com>
2025-11-10 11:34:18 +01:00
Jonty
91e1753d80 Grammatical fix
Signed-off-by: Jonty <jontyleslie@gmail.com>
2025-11-10 11:34:18 +01:00
Jonty
9db27a65c6 Making the American/British spellings consistent to the error messages
Signed-off-by: Jonty <jontyleslie@gmail.com>
2025-11-10 11:34:18 +01:00
dependabot[bot]
efd7424da7 build(deps): bump golang.org/x/sync from 0.17.0 to 0.18.0
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.17.0 to 0.18.0.
- [Commits](https://github.com/golang/sync/compare/v0.17.0...v0.18.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-version: 0.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-10 11:09:20 +01:00
dependabot[bot]
02109c8d33 build(deps): bump golang.org/x/sys from 0.37.0 to 0.38.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.37.0 to 0.38.0.
- [Commits](https://github.com/golang/sys/compare/v0.37.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-version: 0.38.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-10 10:23:37 +01:00
Nicolas De Loof
c37ede62db on up buildOptions must include all enabled services
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-06 16:28:46 +01:00
Nicolas De Loof
7eb5adeef6 introduce --insecure-registry, reserved for testing purpose
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-06 16:17:21 +01:00
Nicolas De Loof
0793ad7c68 document support for OCI and Git remote resources
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-06 16:14:05 +01:00
dependabot[bot]
8137b2bce8 build(deps): bump github.com/docker/cli
Bumps [github.com/docker/cli](https://github.com/docker/cli) from 28.5.1+incompatible to 28.5.2+incompatible.
- [Commits](https://github.com/docker/cli/compare/v28.5.1...v28.5.2)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-version: 28.5.2+incompatible
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-06 10:27:37 +01:00
dependabot[bot]
4e3372b473 build(deps): bump github.com/containerd/containerd/v2
Bumps [github.com/containerd/containerd/v2](https://github.com/containerd/containerd) from 2.1.4 to 2.2.0.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v2.1.4...v2.2.0)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd/v2
  dependency-version: 2.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-06 10:16:04 +01:00
dependabot[bot]
fef26fb372 build(deps): bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 28.5.1+incompatible to 28.5.2+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v28.5.1...v28.5.2)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-version: 28.5.2+incompatible
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-06 10:15:05 +01:00
dependabot[bot]
a32e13a2b0 build(deps): bump github.com/moby/buildkit from 0.25.1 to 0.25.2
Bumps [github.com/moby/buildkit](https://github.com/moby/buildkit) from 0.25.1 to 0.25.2.
- [Release notes](https://github.com/moby/buildkit/releases)
- [Commits](https://github.com/moby/buildkit/compare/v0.25.1...v0.25.2)

---
updated-dependencies:
- dependency-name: github.com/moby/buildkit
  dependency-version: 0.25.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-06 10:14:25 +01:00
Suleiman Dibirov
67e39a41f2 fixes
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
2025-11-06 08:02:59 +01:00
Suleiman Dibirov
dc1283289d fix: use NewParallelCLI in compose_run_build_once_test.go
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
2025-11-06 08:02:59 +01:00
dependabot[bot]
0c596ed3cf build(deps): bump github.com/containerd/platforms
Bumps [github.com/containerd/platforms](https://github.com/containerd/platforms) from 1.0.0-rc.1 to 1.0.0-rc.2.
- [Release notes](https://github.com/containerd/platforms/releases)
- [Commits](https://github.com/containerd/platforms/compare/v1.0.0-rc.1...v1.0.0-rc.2)

---
updated-dependencies:
- dependency-name: github.com/containerd/platforms
  dependency-version: 1.0.0-rc.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-05 17:43:11 +01:00
Nicolas De Loof
13870006fb disable progress UI when build is ran with --print
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-04 17:30:56 +01:00
Nicolas De Loof
af579ebd4b drop support for internal buildkit builder
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-04 11:36:40 +01:00
Nicolas De Loof
fc2a7d13fa from Compose CLI, we know the streams used to configure LogConsumer
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-04 10:25:14 +01:00
Nicolas De Loof
d70bb8cf5e distinguish event (short) status text and details
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-04 10:18:55 +01:00
Nicolas De Loof
bff3d35305 render events in order they were first received
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-11-04 10:18:55 +01:00
Guillaume Lours
b80bb0586e Migrate CLI commands to use LoadProject API
Simplifying the codebase and eliminating duplicate backend creation.

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-11-03 08:58:30 +01:00
Guillaume Lours
d74274bc04 Add LoadProject method to Compose SDK API
This commit adds a new LoadProject method to the Compose service API,
allowing SDK users to programmatically load Compose projects with full
control over the loading process.

Changes:

1. New API method (pkg/api/api.go):
   - LoadProject(ctx, ProjectLoadOptions) (*types.Project, error)
   - ProjectLoadOptions struct with all loader configuration
   - LoadListener callback for event notifications (metrics, etc.)
   - ProjectOptionsFns field for compose-go loader options

2. Implementation (pkg/compose/loader.go):
   - createRemoteLoaders: Git and OCI remote loader setup
   - buildProjectOptions: Translates ProjectLoadOptions to compose-go options
   - postProcessProject: Service filtering, labels, resource pruning

3. Unit test (pkg/compose/loader_test.go):
   - Tests basic project loading functionality
   - Verifies ProjectOptionsFns with cli.WithoutEnvironmentResolution

4. Mock update (pkg/mocks/mock_docker_compose_api.go):
   - Added LoadProject to mock interface

Key design decisions:
- LoadListener pattern keeps metrics collection in CLI, not SDK
- ProjectOptionsFns exposes compose-go options directly (e.g., cli.WithInterpolation(false))
- Post-processing in SDK: labels, service filtering, resource pruning
- Environment resolution NOT in SDK (command responsibility)
- Compatibility mode handling (api.Separator)

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-11-03 08:58:30 +01:00
Stanislav Zhuk
10f15cacdd fix typo in error message
Signed-off-by: Stanislav Zhuk <stasadev@gmail.com>
2025-11-03 08:38:49 +01:00
Guillaume Lours
3658a063bb add AlwaysOkPrompt to replace 'AlwaysYes' current implementation'
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-11-03 08:01:59 +01:00
Sebastiaan van Stijn
74a4ccdd85 fix various linting issues
Got these when running locally on a more recent version of golangci-lint:

    pkg/compose/build_bake.go:187:3: importShadow: shadow of imported from 'github.com/docker/cli/cli/command/image/build' package 'build' (gocritic)
                    build := *service.Build
                    ^
    pkg/compose/build_bake.go:526:19: importShadow: shadow of imported from 'github.com/docker/cli/cli/command/image/build' package 'build' (gocritic)
    func toBakeAttest(build types.BuildConfig) []string {
                      ^
    pkg/compose/create.go:1453:2: importShadow: shadow of imported from 'github.com/docker/docker/api/types/network' package 'network' (gocritic)
            network string,
            ^
    pkg/compose/create.go:1468:2: importShadow: shadow of imported from 'github.com/docker/docker/api/types/network' package 'network' (gocritic)
            network string,
            ^
    pkg/compose/monitor.go:42:17: importShadow: shadow of imported from 'github.com/docker/compose/v2/pkg/api' package 'api' (gocritic)
    func newMonitor(api client.APIClient, project string) *monitor {
                    ^
    cmd/compose/config.go:337:1: File is not properly formatted (gofumpt)
            return
    ^
    pkg/compose/convergence.go:608:1: File is not properly formatted (gofumpt)
                    return
    ^
    pkg/compose/cp.go:335:1: File is not properly formatted (gofumpt)
                    return
    ^
    pkg/e2e/compose_up_test.go:35:10: go-require: c.RunDockerComposeCmd contains assertions that must only be used in the goroutine running the test function (testifylint)
                    res := c.RunDockerComposeCmd(t, "-f", "fixtures/dependencies/deps-completed-successfully.yaml", "--project-name", projectName, "up", "--wait", "-d")
                           ^
    pkg/e2e/healthcheck_test.go:42:10: go-require: c.RunDockerComposeCmd contains assertions that must only be used in the goroutine running the test function (testifylint)
                    res := c.RunDockerComposeCmd(t, "-f", "fixtures/start_interval/compose.yaml", "--project-name", projectName, "up", "--wait", "-d", "test")
                           ^
    10 issues:
    * gocritic: 5
    * gofumpt: 3
    * testifylint: 2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-31 17:44:38 +01:00
Guillaume Lours
6719f47bd4 test checking bake internal load build definition
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-10-30 21:25:32 +01:00
Guillaume Lours
3eb2934eb7 bump compose-go to version v2.9.1
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-10-30 10:12:50 +01:00
Suleiman Dibirov
c416ea7036 fix compose_run_build_once_test.go
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
2025-10-30 10:08:29 +01:00
Suleiman Dibirov
0d396bbacb fix(git): Add validation for Git subdirectory paths to prevent traversal
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
2025-10-30 10:08:29 +01:00
Suleiman Dibirov
fc74c78963 Update e2e tests in compose_run_build_once_test.go to use project names for Docker Compose commands.
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
2025-10-29 10:47:18 +01:00
Suleiman Dibirov
658bff335f Revert "no parallel in compose_run_build_once_test.go"
This reverts commit e4f4a5aa86.

Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
2025-10-29 10:47:18 +01:00
Suleiman Dibirov
80030e1390 no parallel in compose_run_build_once_test.go
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
2025-10-29 10:47:18 +01:00
Suleiman Dibirov
6a35be5112 lint fix
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
2025-10-29 10:47:18 +01:00
Suleiman Dibirov
0c854a6ab7 add e2e tests
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
2025-10-29 10:47:18 +01:00
Suleiman Dibirov
557e0b6ec7 fix(run): Ensure images exist only for the target service in run command
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
2025-10-29 10:47:18 +01:00
Nicolas De Loof
a8933c91e7 stop progress UI during build to prevent interference with buildkit Display
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-29 10:11:30 +01:00
Nicolas De Loof
7e3993bcac skip Start[ed|ing] events to avpd mix with container logs
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-29 10:11:30 +01:00
Nicolas De Loof
fd4f2f99cf register TTYWritter as an Event Processor
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-29 10:11:30 +01:00
Nicolas De Loof
ae25d27e5a remove unused RunWithStatus, always pass operation as title
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-29 10:11:30 +01:00
Nicolas De Loof
394466683a use eventBus to collect tasks progress
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-29 10:11:30 +01:00
Nicolas De Loof
e5c8b68642 decouple Event from tty progress writer
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-29 10:11:30 +01:00
Nicolas De Loof
bf50c99193 pretend cli.Out is a containerd console.File
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-28 14:39:50 +01:00
Guillaume Lours
8274be8d08 configure Compose service with io.Reader and io.Writer
remove usage of internal IO interfaces

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-10-27 18:54:10 +01:00
Guillaume Lours
86e91e010d Add streamOverrideWrapper to intercepts command.Cli stream methods and transparently returns custom streams when provided via options
Add new GetConfiguredStreams function to Compose API definition

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-10-27 16:17:50 +01:00
Guillaume Lours
e1678c5c43 Introduce abstractions to support SDK usage without requiring Docker CLI
This commit prepares the Compose service for SDK usage by abstracting away
the hard dependency on command.Cli. The Docker CLI remains the standard path
for the CLI tool, but SDK users can now provide custom implementations of
streams and context information.

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2025-10-27 16:17:50 +01:00
Nicolas De Loof
5924387e89 run hooks on restart
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-27 10:24:18 +01:00
Nicolas De Loof
7f668bd7fe Setup Compose service using functional parameters
This commit introduces WithMaxConcurrency and WithDryRun to replace direct mutators on composeService
commands and flags are translated into a set of functional parameters which are eventually applied
as a ComposeService is created just before being actually used by a command

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-24 18:24:21 +02:00
Nicolas De Loof
3ce52883cb prompt default implementation to prevent a panic
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-24 10:21:59 +02:00