garden-io / garden

Automation for Kubernetes development and testing. Spin up production-like environments for development, testing, and CI on demand. Use the same configuration and workflows at every step of the process. Speed up your builds and test runs via shared result caching
https://garden.io
Mozilla Public License 2.0
3.37k stars 273 forks source link

0.13: [Bug]: Exiting from dev console does not stop syncs #4834

Open eysi09 opened 1 year ago

eysi09 commented 1 year ago

Garden Bonsai (0.13) Bug

Current Behavior

Syncs stay active after I type exit to exit "normally" from the dev console. This can cause unwanted behaviour if you have reverse syncs enabled where the remote can overwrite files on your host. Because of this, I'm flagging as high priority.

Expected behavior

Syncs are stopped.

Reproducible example

I tested this in the vote example. Basically:

  1. Run garden deploy --sync.
  2. Type exit to exit from the dev console.
  3. Run garden sync status and notice that the syncs are still active.

Workaround

Manually stopping syncs with the sync stop command.

shumailxyz commented 1 year ago

@eysi09 I am unable to reproduce this. Just tried the steps from repro on vote example.

After i typed exit to exit normally from dev console, running garden sync status shows me sync as non-active and gives me this output:

➜  vote git:(main) garden sync status
Getting sync statuses 📟

ℹ garden               → Running in Garden environment local.default
ℹ providers            → Getting status...
✔ providers            → Cached (took 1.1 sec)
ℹ providers            → Run with --force-refresh to force a refresh of provider statuses.
ℹ graph                → Resolving actions and modules...
✔ graph                → Done (took 0.7 sec)
The vote Deploy action has 1 sync configured:
  → Sync from src to /app/src in Deployment/vote is not active
  → Mode: two-way

Also, when i type exit to get out of dev console, the logs show me that sync is disconnected:

┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ ✓ deploy command completed successfully! ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
ℹ deploy.vote          → [sync]: Sync disconnected
✔ deploy.vote          → Stopped sync

────────────────────────────────────────────────────────────────────── 🌼 🌸 🌷 🌺 🌻  ──────────────────────────────────────────────────────────────────────
 🌷  Thanks for stopping by, love you! ❤️
eysi09 commented 1 year ago

This is odd.

Testing again and I don't see the "sync stopped" logs but the sync still seems to be stopped when I check afterwards.

Looks like two (possible related) issues then:

  1. Sync stopped message isn't always displayed
  2. Syncs aren't alway stopped? (That was definitely the case earlier but I can't repro atm).

I'm on latest main and I've tried both while logged in and logged out.

Kapture 2023-07-20 at 19 20 30

10ko commented 8 months ago

We are now showing a warning message when using Ctrl+C to either run sync stop or use Ctrl+D. It would still make sense to fix this.