Commit Graph
30 Commits
Author SHA1 Message Date
Guillaume Lours 8e0d5e17a7 fix: make e2e tests pass reliably locally with Docker Desktop
- Fix stale image/container reuse across test runs                                                                                                                                                                                                                                                          - Add registry readiness check and async removal polling
  - Skip multi-arch test when docker driver supports it
  - Use t.Cleanup for reliable teardown, fix project name mismatches
  - Re-enable 4 previously skipped tests that now pass

Signed-off-by: Guillaume Lours <[email protected]>
2026-05-18 10:55:41 +02:00
Nicolas De loof 5c70712199 fix: restore deprecated Set.Clear/Union; use resource var in pull.go
Assisted-By: docker-agent
Signed-off-by: Nicolas De loof <[email protected]>
2026-05-12 11:31:40 +02:00
Nicolas De loof 07832c4df1 refactor: fix lint issues from cleanup changes
Assisted-By: docker-agent
Signed-off-by: Nicolas De loof <[email protected]>
2026-05-12 11:31:40 +02:00
Nicolas De loof 40d363baf9 refactor: miscellaneous small cleanups (forEach, filters, Set)
Assisted-By: docker-agent
Signed-off-by: Nicolas De loof <[email protected]>
2026-05-12 11:31:40 +02:00
Sebastiaan van Stijn 92a7ac1fa2 fix mixed assertion libraries in tests
Before this, assertion libraries were mixed, sometimes
even in the same file.

    git grep -l '"gotest.tools/v3/' | wc -l
    75
    git grep -l '"github.com/stretchr/testify' | wc -l
    24

Signed-off-by: Sebastiaan van Stijn <[email protected]>
2026-03-31 17:32:51 +02:00
Nicolas De Loof 23fef850b9 prefer use of slices.DeleteFunc
Signed-off-by: Nicolas De Loof <[email protected]>
2025-05-27 15:16:50 +02:00
Nicolas De Loof 12b73bea73 remove utils.Contains to prefer slice.ContainsFunc
Signed-off-by: Nicolas De Loof <[email protected]>
2025-05-27 15:16:50 +02:00
tongjicoder 2e71440bee refactor: use slices.Contains to simplify code
Signed-off-by: tongjicoder <[email protected]>
2025-05-27 11:45:26 +02:00
Sebastiaan van Stijn 446e00520c format code with gofumpt
Format the code  with gofumpt to prevent my IDE from reformatting
every time I open a file. gofumpt provides a superset of gofmt,
so should not impact users that are not using gofumpt.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
2024-12-17 16:50:14 +01:00
Nathan Baulch 524a97e553 Fix typos
Signed-off-by: Nathan Baulch <[email protected]>
2024-09-11 11:21:24 +02:00
Nicolas De loof 6204fb1c94 logs: fix for missing output on container exit (#10925)
We can't assume we receive container logs line by line. Some framework won't buffer output and will send char by char, and we also can receive looong lines which get buffered to 32kb and then cut into multiple logs.

This assumes we will catch container streams being closed before we receive a die event for container, which could be subject to race condition, but at least the impact here is minimal and the fix works for reproduction examples provided in linked issues.

Signed-off-by: Nicolas De Loof <[email protected]>
2023-08-23 08:57:18 -04:00
Milas Bowman caad72713b up: handle various attach use cases better
By default, `compose up` attaches to all services (i.e.
shows log output from every associated container). If
a service is specified, e.g. `compose up foo`, then
only `foo`'s logs are tailed. The `--attach-dependencies`
flag can also be used, so that if `foo` depended upon
`bar`, then `bar`'s logs would also be followed. It's
also possible to use `--no-attach` to filter out one
or more services explicitly, e.g. `compose up --no-attach=noisy`
would launch all services, including `noisy`, and would
show log output from every service _except_ `noisy`.
Lastly, it's possible to use `up --attach` to explicitly
restrict to a subset of services (or their dependencies).

How these flags interact with each other is also worth
thinking through.

There were a few different connected issues here, but
the primary issue was that running `compose up foo` was
always attaching dependencies regardless of `--attach-dependencies`.

The filtering logic here has been updated so that it
behaves predictably both when launching all services
(`compose up`) or a subset (`compose up foo`) as well
as various flag combinations on top of those.

Notably, this required making some changes to how it
watches containers. The logic here between attaching
for logs and monitoring for lifecycle changes is
tightly coupled, so some changes were needed to ensure
that the full set of services being `up`'d are _watched_
and the subset that should have logs shown are _attached_.
(This does mean faking the attach with an event but not
actually doing it.)

While handling that, I adjusted the context lifetimes
here, which improves error handling that gets shown to
the user and should help avoid potential leaks by getting
rid of a `context.Background()`.

Signed-off-by: Milas Bowman <[email protected]>
2023-08-18 12:38:38 +02:00
Nicolas De Loof 46d936c750 support attach
Signed-off-by: Nicolas De Loof <[email protected]>
2023-07-10 14:34:28 +02:00
cui fliter 25ca75db4d fix some comments
Signed-off-by: cui fliter <[email protected]>
2023-07-04 11:34:49 +08:00
Nicolas De Loof 4bf2fe9fed assume we receive logs by lines and don't ignore those without EOL
Signed-off-by: Nicolas De Loof <[email protected]>
2023-06-07 10:40:37 +02:00
Nicolas De loof 1bd8a773a7 detect network conflict as name is not guaranteed to be unique (#10612)
Signed-off-by: Nicolas De Loof <[email protected]>
2023-05-31 14:46:23 -04:00
Nicolas De Loof ca19b7fcc9 introduce WithRootNodesAndDown to walk the graph from specified nodes and down
Signed-off-by: Nicolas De Loof <[email protected]>
2023-05-24 17:32:32 +02:00
Nicolas De Loof 0f5b5ccbd0 detect replacement container is created and inform printer so it attach and don't stop
Signed-off-by: Nicolas De Loof <[email protected]>
2023-02-06 11:23:13 +01:00
Nicolas De Loof c15bf1955a debounce refresh requests with quietperiod
Signed-off-by: Nicolas De Loof <[email protected]>
2023-01-18 22:12:54 +01:00
Nicolas De Loof f1313f3a09 use a simpler prompt implementation when we lack a terminal
Signed-off-by: Nicolas De Loof <[email protected]>
2023-01-09 10:28:16 +01:00
Nicolas De Loof d5e4f00644 introduce --no-attach to ignore some service output
Signed-off-by: Nicolas De Loof <[email protected]>
2023-01-03 18:43:40 +01:00
Sebastiaan van Stijn 87a0a57f70 Cleanup tips from output
The scan tip has been shown for two years, and most users will know
about it by now. Presenting the message also involved checking if the
plugin was installed, and wether or not the message was shown before,
which also caused some overhead, so cleaning up the output a bit.

The corresponding DOCKER_SCAN_SUGGEST environment-variable is also
removed with this.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
2022-12-06 23:29:03 +01:00
Guillaume Lours 3bf29d401c bump docker dependencies version
Signed-off-by: Guillaume Lours <[email protected]>
2022-10-18 16:26:54 +02:00
Ulysses Souza 91eae4f035 Add Codecov
Signed-off-by: Ulysses Souza <[email protected]>
2022-10-17 15:32:51 +02:00
Guillaume Lours e016faac33 don't push images at the end of multi-arch build (and simplify e2e tests)
support DOCKER_DEFAULT_PLATFORM when 'compose up --build'
add tests to check behaviour when DOCKER_DEFAULT_PLATFORM is defined

Signed-off-by: Guillaume Lours <[email protected]>
2022-09-02 15:44:55 +02:00
Milas Bowman 27227a8824 lint: add nolintlint and clean up nolint directives (#9738)
Signed-off-by: Milas Bowman <[email protected]>
2022-08-09 16:43:58 -04:00
Abhinav Nair 11f2f2dbc4 Replace deprecated ioutil pkg with os & io
As of Go 1.16, the same functionality is now provided by package io or
package os, and those implementations should be preferred in new code.

So replacing all usage of ioutil pkg with io & os.

Signed-off-by: Abhinav Nair <[email protected]>
2022-06-25 14:06:10 +08:00
Ulysses Souza 67b4669f9b Add function to convert strings to bool
Typically used on boolean environment variable values

Signed-off-by: Ulysses Souza <[email protected]>
2022-03-04 16:42:37 +01:00
Nicolas De Loof fb73dd58d9 Move compose e2e tests into pkg
Signed-off-by: Nicolas De Loof <[email protected]>
2021-06-28 08:47:58 +02:00
Nicolas De Loof 49e7f2d45d Move compose v2 implementation under pkg/compose with dependencies
Signed-off-by: Nicolas De Loof <[email protected]>
2021-06-15 15:52:48 +02:00