introduce sync+exec watch action by ndeloof · Pull Request #12330 · docker/compose (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation5 Commits5 Checks28 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

ndeloof

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

darkleaf, slaughtlaught, devleifr, KGOH, SergeyFM, BatON-RW, and qg-m-kondratenko reacted with thumbs up emoji darkleaf, slaughtlaught, krevedkokun, devleifr, and KGOH reacted with rocket emoji

@ndeloof ndeloof requested review froma team and glours and removed request fora team

November 28, 2024 08:52

@ndeloof ndeloof marked this pull request as ready for review

December 3, 2024 12:47

@glours

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

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

@ndeloof

@ndeloof

Signed-off-by: Nicolas De Loof nicolas.deloof@gmail.com

@ndeloof

Signed-off-by: Nicolas De Loof nicolas.deloof@gmail.com

@ndeloof

Signed-off-by: Nicolas De Loof nicolas.deloof@gmail.com

@ndeloof

Signed-off-by: Nicolas De Loof nicolas.deloof@gmail.com

glours

Choose a reason for hiding this comment

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

LGTM

@ndeloof @glours

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

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request

Dec 20, 2024

@tmeijn

2 participants

@ndeloof @glours