Skip to content

Conversation

remcokranenburg
Copy link

Note: this PR is reopened unchanged from one that was closed due to inactivity.

What I did
Just like #11932, which added watch --prune, but now for the up command.

Related issue
#11073

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

Signed-off-by: Remco Kranenburg <remco.kranenburg@crunchr.com>
@remcokranenburg remcokranenburg requested a review from a team as a code owner March 17, 2025 14:48
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.

@ndeloof what do you think, shouldn't we use WatchOptions directly here? I don't have a strong option

Comment on lines 317 to +318
Watch: upOptions.watch,
Prune: upOptions.prune,
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should not pass directly WatchOptions

Copy link
Contributor

Choose a reason for hiding this comment

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

we should just drop the api package and get CLI options used by composeService

@@ -170,6 +171,7 @@ func upCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *c
flags.BoolVar(&up.wait, "wait", false, "Wait for services to be running|healthy. Implies detached mode.")
flags.IntVar(&up.waitTimeout, "wait-timeout", 0, "Maximum duration in seconds to wait for the project to be running|healthy")
flags.BoolVarP(&up.watch, "watch", "w", false, "Watch source code and rebuild/refresh containers when files are updated.")
flags.BoolVar(&up.prune, "prune", false, "Prune dangling images on rebuild")
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder: is there any benefits not pruning those ? Shall we just make this the default ? Then do we need a flag ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, I agree
@remcokranenburg do you mind adapting your PR to prune by default? We just need to keep it for the watch command itself to let users who want it to choose the option of keeping dangling images

Copy link
Author

Choose a reason for hiding this comment

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

Sure! Would you also like to prune by default for the watch command? That might be more consistent, thus less surprising.

By keeping the flag, it should be possible to disable in either up or watch with --prune=0

Copy link
Contributor

Choose a reason for hiding this comment

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

up already has so much flags we'd prefer not to have more. For those who really want to keep dangling images (?) watch --prune=false could be a reasonable workaround

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I'm aligned with @ndeloof on this one, just keep the --prune flag for the watch command
BTW thank you for doing it 🙏

@ndeloof
Copy link
Contributor

ndeloof commented Mar 17, 2025

you have to run make docs as a new flag has been introduced

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.

3 participants