builder: fix default docker context behavior #1454
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With changes from #1430 we are now setting the expected builder name and not
default
fordocker
builders:buildx/builder/builder.go
Lines 100 to 102 in fe8d562
When switching to another context other than
default
likedocker context use foo
, build will not work as it still expectsdefault
to be the active context:Another issue also linked to this change is that enabled context builder other than
default
(heredocker2010
) appears twice in the list and also docker nodes are always set todefault
:And as you can see the
ls
command doesn't show the current builder (with*
) anymore when switching to another docker context builder. Node name for docker builders is also not correct.This PR avoids setting the builder name in the new builder client and lets the store doing it. To make a clear distinction with context builders for validation, a new field
DockerContext
has been added. This also avoids unnecessary loading of contexts for validation:Also found out that
buildx inspect
command does not return the correct builder when switching to another context other thandefault
in current 0.9.1:With this PR: