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

bake: switch to controller #1861

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Conversation

crazy-max
Copy link
Member

@crazy-max crazy-max commented Jun 1, 2023

Carry #1680 to handle controller options with bake and also use controller to build. This will be used in #1841 so we can pass the build reference to the result context for both build and bake efficiently.

@crazy-max crazy-max requested review from jedevc and ktock June 1, 2023 08:10
@crazy-max crazy-max force-pushed the bake-controller branch 3 times, most recently from 5d4b713 to 1c7055c Compare June 1, 2023 09:28
@crazy-max crazy-max marked this pull request as draft June 1, 2023 09:40
@crazy-max crazy-max force-pushed the bake-controller branch 2 times, most recently from c03f580 to 8852925 Compare June 1, 2023 11:37
controller/build/build.go Outdated Show resolved Hide resolved
func RunBuild(ctx context.Context, dockerCli command.Cli, in controllerapi.BuildOptions, inStream io.Reader, progress progress.Writer, generateResult bool) (*client.SolveResponse, *build.ResultContext, error) {
if in.NoCache && len(in.NoCacheFilter) > 0 {
return nil, nil, errors.Errorf("--no-cache and --no-cache-filter cannot currently be used together")
func RunBuild(ctx context.Context, dockerCli command.Cli, builderName string, in *controllerapi.BuildOptions, inStream io.Reader, progress progress.Writer, generateResult bool) (*client.SolveResponse, *build.ResultContext, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need to have a separated builderName option? This looks already included in the controllerapi.BuildOptions.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was looking at passing just the list of nodes necessary to build so we don't create another builder instance. But when building multiple targets controller.BuildOptions is a map and I don't think having Builder there is right:

string Builder = 23;

I will take another look to improve this.

@crazy-max crazy-max marked this pull request as ready for review June 1, 2023 16:37
@crazy-max
Copy link
Member Author

@ktock @jedevc Bake does not handle the context path hash like build (we just take the current work dir atm). This is also just specific to the k8s driver and should move there. I think we already discuss about it but can't put my finger on it.

jedevc and others added 5 commits June 7, 2023 01:46
This patch continues the move to attempt to merge the build.Options
struct into the controllerapi.Options message.

To do this, we extract all the input parameters into a dedicated message
(adding the missing ones, except for the InStream parameter which will
require some additional fiddling around). We also rework the
NamedContexts to allow containing States (by transmitting them as
DefinitionOps), and adding a Linked field to the common options.

Signed-off-by: CrazyMax <[email protected]>
With the previous changes to bring controllerapi.BuildOptions up to date
with build.Options, we can have bake generate
controllerapi.BuildOptions, and then convert those to build.Option using
the controller/build package.

This is an intermediate patch, designed to allow us to clean up some
shared logic between both build and bake. The next step will be to
modify bake to use the controller api, and completely skip the
build.Options generation step.

Signed-off-by: CrazyMax <[email protected]>
With this change we are now passing a list of controller options
to run a build and returns a map of responses and result context
as bake can handle a list of targets.

Signed-off-by: CrazyMax <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants