Commit Graph

714 Commits

Author SHA1 Message Date
Nicolas De Loof 06ec06472f up should not silently ignore missing depends_on service
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-26 21:59:29 +02:00
Nicolas De Loof 466e1d3197
prevent buildkt's progress to render `Building` when no built is needed
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-26 15:04:37 +02:00
Nicolas De Loof 0d6b99e6f9
e2e test to cover logs -f managing service being added/scaled
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-26 14:51:23 +02:00
Nicolas De Loof 01d91c490c detect new container from project have started when running `compose logs` with no explicit services
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-26 14:15:48 +02:00
Nicolas De Loof 6f6e1635fd compute service hash with a default DeployConfig
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-26 14:15:33 +02:00
Jeremy Fleischman 3d05a1becf
Fix typo in warning about existing volume
Previously, this was telling us "but was not created for project
[project-it-was-created-for]", which is wrong. I opted to make the
message super explicit and print both the actual project and the
expected project.

Signed-off-by: Jeremy Fleischman <jeremyfleischman@gmail.com>
2023-05-25 17:16:47 -07:00
Milas Bowman b05a94fd66
progress: remove errant import (#10614)
Write the warning using `logrus.Warn`. The function being used was
coming from `cfssl`'s log package, which was presumably the result
of auto-import being _slightly_ too aggressive.

(Note: `cfssl` is still an indirect dependency after this.)

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-05-24 17:08:46 -04:00
Nicolas De Loof c7afc6188b detect conflict removing volume/image and warn user
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-24 17:32:32 +02:00
Nicolas De Loof ca19b7fcc9 introduce WithRootNodesAndDown to walk the graph from specified nodes and down
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-24 17:32:32 +02:00
Nicolas De Loof 93bd27a0cc introduce ability to select service to be stopped by `compose down`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-24 17:32:32 +02:00
Nicolas De loof 68c462e607
scale: sort containers by creation date to remove older ones first (#10571)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-23 13:58:32 -04:00
Nicolas De loof 916aac6c27
watch: only monitor configured paths (#10599)
For performance, don't watch the entire build context.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-23 13:35:50 -04:00
Nicolas De loof eafcd1b35e
secrets: only set CopyUIDGID when required (#10598)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-23 13:34:24 -04:00
Nicolas De Loof cfe1a860ff
fix detection of swarm mode
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-22 08:26:22 +02:00
Guillaume Lours cd0fc214a5 only check the platform of cached image if image found
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-05-17 08:04:54 +02:00
Nicolas De Loof 9b5a4588f9 introduce --no-path-resolution to skip relative path to be resolved
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-16 13:02:56 +02:00
Nicolas De Loof 00f72cb553 report external network not found when swarm is disabled
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-15 20:57:19 +02:00
Nicolas De Loof 18a112e88c detect terminal is not a `console.File` to avoid a panic
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-15 20:56:33 +02:00
Mateus Esdras 77dc9b54f3
rm: remove debugging output (#10554)
For example, when no container was being removed,
this would print `[]`.

Signed-off-by: Mateus Esdras <linux.esdras@gmail.com>
2023-05-11 16:32:29 -04:00
Nicolas De loof bceb3c1876
detect active endpoint trying to remove network and skip with a warning (#10555)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-11 16:31:29 -04:00
Nicolas De loof a14abb9044
cli: option to write status messages on stdout (#10549)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-11 12:45:00 -04:00
Nicolas De loof 0363d9260a
fix local image removal when `compose down` is ran with `--project-name` (#10558)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-11 12:41:14 -04:00
Nicolas De Loof b776826d92 check local image matches the required platform
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-10 16:57:21 +02:00
Nicolas De Loof e92c5d1392 fix race condition running `compose up` with --parallel < number of services
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-10 11:39:07 +02:00
Nicolas De loof 67455e9f33
fix builkit progressui integration (#10535)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-08 09:21:41 -04:00
Guillaume Lours 5fdcaa0fe1
Merge pull request #10529 from glours/dry-run-up-support
add dry-run support to up command
2023-05-05 09:41:18 +02:00
Guillaume Lours 2e4faf80f5 add dry-run support to up command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-05-04 15:11:11 +02:00
Nicolas De Loof b45ca82791
let user declare build secret target (id)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-04 10:01:10 +02:00
TP-O b304c4e154 stop containers after termination
Signed-off-by: TP-O <letranphong2k1@gmail.com>
2023-05-03 11:47:56 +02:00
Guillaume Lours eca1365d42
cli: dry run support for `build` (#10502)
* add dry-run support for classic builder
* add dry-run support for buildkit

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-05-02 14:23:26 -04:00
Guillaume Lours 03f4c0e631
progress: make title configurable (#10507)
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-05-02 14:15:35 -04:00
Nicolas De Loof 07c4849cb9 TailMsgf must format with args
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-04-27 22:12:12 +02:00
Nicolas De Loof d01ef5887a restore support for `--memory`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-04-25 15:41:08 +02:00
Nicolas De Loof dec608f3cd don't block events loop collecting logs
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-04-25 15:20:05 +02:00
Milas Bowman 1383ab09ec test: fix E2E tests under Engine v23 / DD 4.19
Some error messages have been tweaked slightly, this adapts the
assertions to work on both Engine v20.10.x and v23.x.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-04-25 08:27:42 +02:00
Benjamín Guzmán 5eaafe4237 Fixed issue when project name contains dashes (`-`)
Signed-off-by: Benjamín Guzmán <bg@benjaminguzman.dev>
2023-04-24 12:18:37 +02:00
Benjamín Guzmán 7840a92c40 Added tests to `viz` subcommand
Signed-off-by: Benjamín Guzmán <bg@benjaminguzman.dev>
2023-04-24 12:18:37 +02:00
Nicolas De Loof 65fda18821 bump compose-go
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-04-17 17:19:56 +02:00
Tran Phong 0e7e1b940b
Remove redundant goroutine while removing containers (#10449)
don't use goroutine to stop container while removing

Signed-off-by: TP-O <letranphong2k1@gmail.com>
2023-04-17 10:57:29 -04:00
Milas Bowman af6f0ffb9e
Merge pull request #10458 from thaJeztah/simplify_auth
Don't use "info.IndexServerAddress" for authentication
2023-04-12 12:19:04 -04:00
Milas Bowman 9ef173a3ac
log: fix race on container kill (#10459)
If we go to inspect a container that we got an event for and it
no longer exists on the server, handle clean up without erroring
out.

Fixes #10373.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-04-12 12:15:58 -04:00
Sebastiaan van Stijn 1892be8c70
Don't use "info.IndexServerAddress" for authentication
The IndexServerAddress field was  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.

This replaces the code that calls out to the "/info" endpoint to use the
GetAuthConfigKey() function instead.

Related PR in docker/cli:
b4ca1c7368

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-11 23:10:22 +02:00
Guillaume Lours 7fb87856aa add dry-run support to down command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-04-07 10:41:51 +02:00
Guillaume Lours cb688b5fd4
fix gocyclo lint error which currently block Compose CI
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-04-07 10:19:06 +02:00
Nicolas De Loof 8b5b78fbb6 can't watch a service without a build section
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-04-06 08:55:49 +02:00
Nicolas De loof d762f5f473
better support NO_COLOR by disabling colors, not ANSI TUI (#10434)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-04-04 17:00:10 -04:00
Milas Bowman 7ce0096f40 ci: bump Go to 1.20.3 and various dependencies
Use latest Go minor release. Note: this release included fixes for
several CVEs, but they do not impact Compose.

Small errors have been fixed to keep the linter happy.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-04-04 15:15:02 -04:00
Nicolas De Loof a10c4c6df5
restore `--timeout` flag renamed by mistake
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-04-04 08:48:00 +02:00
Guillaume Lours 6a37428491
Merge pull request #10413 from glours/dry-run-create-support
add dry-run support to create command
2023-04-03 18:25:55 +02:00
Nicolas De Loof 981cb2024e
prevent panic using classic builder
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-31 11:59:22 +02:00
Guillaume Lours b83edbd039 add dry-run support to create command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-03-30 10:25:56 +02:00
Nicolas De Loof c5317496ac
workaround race condition in ContainerList
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-28 12:28:41 +02:00
Guillaume Lours 72a61c0602 add dry-run support to run command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-03-27 18:57:11 +02:00
Milas Bowman d818bf6f34
Merge pull request #10401 from milas/deps-update
ci: upgrade to Go 1.20.2 & bump deps
2023-03-24 11:05:53 -04:00
Milas Bowman cd17c8a950 test: update error message
Validation got improved in `compose-go` so the error message is
slightly different.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-03-24 10:42:43 -04:00
Milas Bowman 36625ed229 test: fix race in e2e build test
This was running two tests in parallel that would build/delete the
same images. Run in serial instead since that's not safe.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-03-24 10:32:55 -04:00
Nicolas De Loof d637cc3ade watch involves up --build after change has been detected
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-24 10:49:27 +01:00
Milas Bowman 16d5354d70 watch: add note about goroutine-safety & test
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-03-23 11:33:03 -04:00
Milas Bowman 7aaea283ca watch: data race / segfault fixes
Was getting segfaults with multiple services using
`x-develop` and `watch` at the same time. Turns out
the Moby path matcher lazily initializes the regex
pattern internally the first time it's used, so it's
not goroutine-safe.

Change here is to not use a global instance for the
ephemeral path matcher, but a per-watcher instance.

Additionally, the data race detector caught a couple
other issues that were easy enough to fix:
 * Use the lock that's used elsewhere for convergence
   before manipulating
 * Eliminate concurrent map access when triggering
   rebuilds

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-03-22 18:05:56 -04:00
Nicolas De Loof a11515e038 introduce `ignore` attribute for watch triggers
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-21 18:29:49 +01:00
Nicolas De Loof 6c1f06e420 Run classic builder with BuildConfig, not buildx.Options
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-21 15:37:55 +01:00
Nicolas De Loof 88b0d17ff8 use `build` as common API for build scenarios
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-21 15:37:55 +01:00
Nicolas De Loof 9e19bc8441 use progress to show copy status
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-21 14:40:52 +01:00
Milas Bowman 105a7c5b70 watch: add file delete/rename handling
This approach mimics Tilt's behavior[^1]:
 1. At sync time, `stat` the path on host
 2. If the path does not exist -> `rm` from container
 3. If the path exists -> sync to container

By handling things this way, we're always syncing based on the true
state, regardless of what's happened in the interim. For example, a
common pattern in POSIX tools is to create a file and then rename it
over an existing file. Based on timing, this could be a sync, delete,
sync (every file gets seen & processed) OR a delete, sync (by the
the time we process the event, the "temp" file is already gone, so
we just delete it from the container, where it never existed, but
that's fine since we deletes are idempotent thanks to the `-f` flag
on `rm`).

Additionally, when syncing, if the `stat` call shows it's for a
directory, we ignore it. Otherwise, duplicate, nested copies of the
entire path could get synced in. (On some OSes, an event for the
directory gets dispatched when a file inside of it is modified. In
practice, I think we might want this pushed further down in the
watching code, but since we're already `stat`ing the paths here now,
it's a good place to handle it.)

Lastly, there's some very light changes to the text when it does a
full rebuild that will list out the (merged) set of paths that
triggered it. We can continue to improve the output, but this is
really helpful for understanding why it's rebuilding.

[^1]: db7f887b06/internal/controllers/core/liveupdate/reconciler.go (L911)

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-03-21 08:37:18 -04:00
Luis Rascao bfeb1dc277 Fix concurrent map read/write when recreating containers
Signed-off-by: Luis Rascao <luis.rascao@gmail.com>
2023-03-19 21:56:06 +01:00
Laura Brehm 200f47e5be Add support for `additional_contexts` in `build` service config
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-03-15 14:00:51 +01:00
Nicolas De Loof e0aaccf430 introduce dockerfile_inline
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-15 10:19:04 +01:00
Nicolas De Loof 754c06886f one off container name use configured Separator for naming
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-15 09:47:43 +01:00
Nicolas De Loof e492330dd5 collect built image IDs
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-15 09:47:32 +01:00
Nicolas De Loof bbe1b77a67 progress writer uses dockercli.Err stream
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-15 09:47:13 +01:00
Nicolas De Loof 85ddfde5d6 use go 1.20 -cover support
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-10 16:54:39 +00:00
Nicolas De Loof 6a0398d786 pad can be negative on small terminal
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-09 10:27:43 +00:00
Guillaume Lours 4434cea535 add dry-run support for push command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-03-08 14:23:57 +00:00
Guillaume Lours 3f7d3c2661 add dry-run support for pull command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-03-05 22:04:32 +01:00
Guillaume Lours 167c6a89b1 add dry-run support to restart command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-03-02 10:14:59 +01:00
Guillaume Lours 3cfbac6624
restart only needed services by checking depends_on relations
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-03-01 18:22:40 +01:00
Nicolas De Loof 4ea44797f5 only consider containers with config_hash labels (i.e, created by compose)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-01 15:46:50 +01:00
Milas Bowman e31b95c16d test: tweak pause test to try and prevent failures in Windows CI
This test keeps failing with a timeout in Windows. I don't actually
think it should take that long to bring up an nginx container, so
I'm guessing that there's something else going on that's causing
trouble.

Increase the verbosity when running Compose commands: I think this
will generally make E2E test failures easier to diagnose by always
logging the full command that's going to be run and also capturing
stdout.

Add a health check and use `--wait` when launching the fixture for
the pause test. Combined with the verbosity increase, this should
make it easier to understand what's going on here.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-27 14:20:20 -05:00
Milas Bowman da1ca578b5 watch: ignore ephemeral files & minor output tweaks
Big change here is to import the ephemeral ignore set from Tilt.

The `.git` directory is also ignored for now: this restriction
should probably be lifted and made configurable in the future,
but it's not generally important to watch and triggers a LOT of
events (e.g. Git creates `index.lock` files that will appear and
disappear rapidly as terminals/IDEs/etc interact with Git, even
for read-only operations).

The Tilt-provided ephemeral file set has been slowly devised over
time based on temporary files that can cause trouble. We can also
look at a more robust/configurable solution here in the future,
but thse provide a reasonable out-of-the-box configuration for
the moment.

There's also some small tweaks to the output to add missing
newlines in a few edge cases and such.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-24 14:34:51 -05:00
Josh Wilson 6fae6a41f9 Update emacs ignore patterns (#5903)
Currently the emacs ignore patterns include `**/.#*` (lock files), but
doesn't include `**/#*#` (autosave files;
https://www.emacswiki.org/emacs/AutoSave, not to be confused with
`**/*~` backup files which are ignored.)

Add autosave files.
2022-07-26 08:57:40 -05:00
Milas Bowman dd5ea044bb ignore: add Go umask files to ephemeral set (#5740)
When creating files in Go, the stdlib will create (and then rapidly
delete) files ending with `-go-tmp-umask` to determine the umask
to use for permission purposes.

This can cause trouble with Live Update because the files tend to
vanish underneath it, for example.

Fixes #5117.
2022-04-27 16:42:51 -04:00
Milas Bowman 12de97b8d1 filewatch: use apiserver FileWatch model in EngineState (#4277)
This follows the "action-first" approach to use the apiserver model
for `FileWatch` and dispatch simple create/update/delete actions.
2021-03-09 13:05:32 -05:00
Iggy Jackson 62b5f78fd9 Add .kate-swp files to ignore pattern (#3380)
KDE's text editor, kate, uses a file similar to Vim's .swp files. Ignore
these files so we don't rebuild on every keypress.

Fixes #3378
2020-05-27 07:36:06 -07:00
Nick Santos 3f526c5c7b change org name from windmilleng to tilt-dev (#3346) 2020-05-15 10:34:39 -04:00
Matt Landis 12916b75a2 tilt: ignore a few more vim swap files (#2190) 2019-09-12 11:57:39 -04:00
Maia McCormick e3948f6bae ignore: auto-ignore jetbrains .idea file (#2065) 2019-08-15 14:38:44 -04:00
Dan Miller 91a2bdd6de model: move to pkg (#2024) 2019-08-09 12:52:31 -04:00
Nick Santos ce61e7bf18 ignore: improve the ephemeral temp file patterns [ch2663] (#1925) 2019-07-29 11:18:22 -04:00
Nicolas De Loof e831ea826b add support for `restart` for `depends_on`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-18 12:55:29 +01:00
Milas Bowman 762cf9d998
Merge pull request #10252 from glours/dry-run-exec-support
support dry-run for exec command
2023-02-17 10:05:31 -05:00
Nicolas De Loof 24ff098252 compact TUI to monitor layers download progress
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-16 17:55:59 +01:00
Nicolas De Loof 313b82e94c ignore services without a build section
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-14 15:18:44 +01:00
Nicolas De Loof 9ac0392baf introduce --timeout on `up`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-14 12:16:41 +01:00
Nicolas De Loof 92e0cd4047 also restart dependent services after a service has been restarted
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-14 11:30:15 +01:00
Nicolas De Loof 256ec49974 exclude unstable labels from config hash
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-13 17:02:28 +01:00
Nicolas De Loof 9765f171cd
store exec details to offer better dry-run status on ExecStart
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-13 11:59:01 +01:00
Nicolas De Loof b19df5c96c add support for `excludes` and `rebuild`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-10 17:24:48 +01:00
Nicolas De Loof 7a42ba7eec use CGO to enable fsevent on OSX
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-10 17:24:48 +01:00
Guillaume Lours eb1c798912 support dry-run for rm command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-02-09 17:34:10 +01:00
Guillaume Lours 78b9404767 support dry-run for stop command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-02-09 17:34:10 +01:00