-
Notifications
You must be signed in to change notification settings - Fork 482
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
Proposal: add new --sync-output flag to bake #1197
base: master
Are you sure you want to change the base?
Conversation
Yes that's exactly what I had in mind 👍 |
449a668
to
0857015
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed an extra commit as simple test case but we should look at implementing integration tests (pretty much like BuildKit with testutil).
func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, docker DockerAPI, configDir string, w progress.Writer, syncOutputs bool) (resp map[string]*client.SolveResponse, err error) { | ||
return BuildWithResultHandler(ctx, drivers, opt, docker, configDir, w, nil, syncOutputs, false) | ||
} | ||
|
||
func BuildWithResultHandler(ctx context.Context, drivers []DriverInfo, opt map[string]Options, docker DockerAPI, configDir string, w progress.Writer, resultHandleFunc func(driverIndex int, rCtx *ResultContext), allowNoOutput bool) (resp map[string]*client.SolveResponse, err error) { | ||
func BuildWithResultHandler(ctx context.Context, drivers []DriverInfo, opt map[string]Options, docker DockerAPI, configDir string, w progress.Writer, resultHandleFunc func(driverIndex int, rCtx *ResultContext), syncOutputs bool, allowNoOutput bool) (resp map[string]*client.SolveResponse, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should look at refactoring these funcs in a follow-up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, have avoided making too many changes since #1296 refactors around this as well.
@@ -25,6 +25,7 @@ Build from a file | |||
| [`--pull`](#pull) | | | Always attempt to pull all referenced images | | |||
| `--push` | | | Shorthand for `--set=*.output=type=registry` | | |||
| [`--set`](#set) | `stringArray` | | Override target value (e.g., `targetpattern.key=value`) | | |||
| `--sync-output` | | | Ensure all builds complete before beginning output | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe --sync
would be enough? There are some cases where we might not need to output anything but keep build result synced (type=cacheonly
)?
| `--sync-output` | | | Ensure all builds complete before beginning output | | |
| `--sync` | | | Ensure all builds complete before returning result | |
Let's also add a simple example here for this flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think --sync
isn't enough, you want to hint it is about synching the 'stuff at the end'
a73a4f9
to
0ac4310
Compare
Have updated with the new Evaluate API introduced in moby/buildkit#3137. Still not sure about the flag name, but the functionality should be correct now (have tested with buildkit before+after the evaluate API merged to check the StatFile fallback works correctly). |
Adding to the v0.10 milestone, think this would be good to get in there. Revisiting this after a while, I wonder if maybe we might want to make this the default behavior? Or some other way that doesn't involve needing to add lots more flags, IMO not needing a lot of extra flags on the cli is one of the selling points of bake 🤔 |
This patch introduces a new syncable output option, which ensures that all builds finish simultaneously in the solver, so that no outputs are completed independently of each other. This allows bake to easily express the notion that either all builds should succeed and output or none of them should. Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
ec88287
to
048e6ac
Compare
Ping @tonistiigi @crazy-max any thoughts on the overall approach here? I'm a bit hesitant around adding new flags to the CLI though 🤔 Possible approaches:
|
Does the current action support |
Having a I'm thinking about another use case now. Should we have a |
Yeah, if we have a sync field, having the ability to sync at different points would be good:
|
Potentially fixes #1089.
Depends on a server that includes that patch here: moby/buildkit#2947This proposal patch introduces a new syncable output option, which ensures that all builds finish simultaneously in the solver, so that no outputs are completed independently of each other. This allows bake to easily express the notion that either all builds should succeed and output or none of them should.
Usage:
Comments and thoughts appreciated 🎉