Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce sync+exec watch action #12330

Merged
merged 5 commits into from
Dec 6, 2024
Merged

introduce sync+exec watch action #12330

merged 5 commits into from
Dec 6, 2024

Conversation

ndeloof
Copy link
Contributor

@ndeloof ndeloof commented Nov 27, 2024

What I did
introduce sync+exec watch action to run a command inside container after sync updated filesystem
TODO: e2e test

Related issue
closes #12318
requires compose-spec/compose-go#715

(not mandatory) A picture of a cute animal, if possible in relation to what you did

@ndeloof ndeloof force-pushed the synx_exec branch 2 times, most recently from a3fd624 to 705ee17 Compare November 27, 2024 17:19
@ndeloof ndeloof requested review from a team and glours and removed request for a team November 28, 2024 08:52
@ndeloof ndeloof marked this pull request as ready for review December 3, 2024 12:47
@ndeloof ndeloof force-pushed the synx_exec branch 3 times, most recently from 97bafbb to f06f368 Compare December 5, 2024 15:03
@glours
Copy link
Contributor

glours commented Dec 6, 2024

I tested with the avatars project and I noticed that watch applied a sync action instead of a rebuild one when updating the requirement.txt file
Behaviour with this branch:

> docker compose up --watch                                                                                                                                                                                                       node system 13:50:24
[+] Running 3/3
 ✔ Network avatars_default  Created                                                                                                                                                                                                                                         0.0s
 ✔ Container avatars-api-1  Created                                                                                                                                                                                                                                         0.1s
 ✔ Container avatars-web-1  Created                                                                                                                                                                                                                                         0.1s
        ⦿ Watch enabled
Attaching to api-1, web-1
web-1   | yarn run v1.22.22
api-1   |  * Serving Flask app './api/app.py' (lazy loading)
api-1   |  * Environment: development
api-1   |  * Debug mode: on
web-1   | $ vite
api-1   |  * Debugger is active!
        ⦿ Syncing service "api" after 1 changes were detected

Behaviour on main branch:

> docker compose up --watch                                                                                                                                                                                                       node system 13:47:44
[+] Running 3/3
 ✔ Network avatars_default  Created                                                                                                                                                                                                                                         0.0s
 ✔ Container avatars-web-1  Created                                                                                                                                                                                                                                         0.1s
 ✔ Container avatars-api-1  Created                                                                                                                                                                                                                                         0.1s
        ⦿ Watch enabled
Attaching to api-1, web-1
web-1   | yarn run v1.22.22
web-1   | $ vite
api-1   |  * Serving Flask app './api/app.py' (lazy loading)
api-1   |  * Environment: development
api-1   |  * Debug mode: on
api-1   |  * Debugger is active!
        ⦿ Rebuilding service "api" after changes were detected...
        ⦿ service "api" successfully built
api-1 exited with code 0
api-1 has been recreated
api-1   |  * Serving Flask app './api/app.py' (lazy loading)
api-1   |  * Environment: development
api-1   |  * Debug mode: on
api-1   |  * Debugger is active!

@ndeloof
Copy link
Contributor Author

ndeloof commented Dec 6, 2024

api/requirements.txt file event matches multiple watch rules, so the confusion :'(

@ndeloof
Copy link
Contributor Author

ndeloof commented Dec 6, 2024

@glours fixed

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

pkg/e2e/watch_test.go Outdated Show resolved Hide resolved
@ndeloof ndeloof enabled auto-merge (rebase) December 6, 2024 14:28
Co-authored-by: Guillaume Lours <705411+glours@users.noreply.github.com>
Signed-off-by: Nicolas De loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof ndeloof merged commit a1729c5 into docker:main Dec 6, 2024
28 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Dec 20, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [docker/compose](https://github.com/docker/compose) | minor | `v2.31.0` -> `v2.32.1` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>docker/compose (docker/compose)</summary>

### [`v2.32.1`](https://github.com/docker/compose/releases/tag/v2.32.1)

[Compare Source](docker/compose@v2.32.0...v2.32.1)

#### What's Changed

##### 🐛 Fixes

-   only check volume mounts for updated config by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#12386
-   e2e test to prevent future regression by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#12389

**Full Changelog**: docker/compose@v2.32.0...v2.32.1

### [`v2.32.0`](https://github.com/docker/compose/releases/tag/v2.32.0)

[Compare Source](docker/compose@v2.31.0...v2.32.0)

#### What's Changed

##### ✨ Improvements

-   build with bake by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#12344
-   introduce watch restart action by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#12375
-   introduce sync+exec watch action by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#12330
-   Recreate container on volume configuration change by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#12363

##### 🐛 Fixes

-   fix support for service.mac_address by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#12371
-   pull --quiet should not drop status message, only progress by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#12358
-   do not require a build section but for `rebuild` action by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#12343
-   log configuration error as a watch log event by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#12359

##### 🔧  Internal

-   disable failing TestBuildSSH test by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#12349
-   Make e2e tests pass locally by [@&#8203;glours](https://github.com/glours) in docker/compose#12348

##### ⚙️ Dependencies

-   bump docker + buildx to latest release by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#12372
-   bump otel dependencies to v1.28.0 and v0.53.0 to align with buildx, buildkit and engine versions by [@&#8203;glours](https://github.com/glours) in docker/compose#12338
-   build(deps): bump golang.org/x/sys from 0.27.0 to 0.28.0 by [@&#8203;dependabot](https://github.com/dependabot) in docker/compose#12378
-   build(deps): bump golang.org/x/crypto from 0.27.0 to 0.31.0 by [@&#8203;dependabot](https://github.com/dependabot) in docker/compose#12377
-   build(deps): bump google.golang.org/grpc from 1.68.0 to 1.68.1 by [@&#8203;dependabot](https://github.com/dependabot) in docker/compose#12353
-   build(deps): bump golang.org/x/sync from 0.9.0 to 0.10.0 by [@&#8203;dependabot](https://github.com/dependabot) in docker/compose#12352
-   update xx to v1.6.1 for compatibility with alpine 3.21 and file 5.46+ by [@&#8203;thaJeztah](https://github.com/thaJeztah) in docker/compose#12366

**Full Changelog**: docker/compose@v2.31.0...v2.32.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS42NC4wIiwidXBkYXRlZEluVmVyIjoiMzkuNjkuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Watch: sync+reload mode
2 participants