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

Implement ability to load images by default in non-Docker build drivers. #2259

Merged
merged 1 commit into from Apr 5, 2024

Conversation

n-g
Copy link
Contributor

@n-g n-g commented Feb 16, 2024

This eases build driver migrations, as it allows aligning the default behavior.

See also https://docs.docker.com/build/drivers/

Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

This could also be a driver-opt maybe?

controller/build/build.go Outdated Show resolved Hide resolved
@n-g
Copy link
Contributor Author

n-g commented Feb 22, 2024

This could also be a driver-opt maybe?

Thanks! I like this path, as it allows finer granularity when selecting the new behavior (per driver vs per env).
From what I can tell, this is the first driver-opt applicable to multiple driver types.
I introduced a new feature, but lmk if there is a cleaner modeling path I could employ.

@n-g n-g requested a review from tonistiigi February 22, 2024 22:18
@n-g n-g force-pushed the master branch 2 times, most recently from 3ba8f17 to 9889528 Compare February 27, 2024 11:04
@n-g n-g force-pushed the master branch 2 times, most recently from f93683d to 03340c5 Compare February 29, 2024 10:41
@n-g n-g requested a review from crazy-max February 29, 2024 10:44
driver/features.go Outdated Show resolved Hide resolved
@n-g
Copy link
Contributor Author

n-g commented Mar 8, 2024

@tonistiigi @crazy-max
Thanks for taking a look at this!
From what I can tell, I addressed all your suggestions.
Is there anything left to do to make this PR ready to merge?
Thanks!

driver/features.go Outdated Show resolved Hide resolved
@n-g n-g force-pushed the master branch 2 times, most recently from fa960fa to 8e7dbc3 Compare March 8, 2024 11:37
@n-g n-g requested a review from dvdksn March 8, 2024 11:37
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

Can you squash your commits please?

Also would be nice to have integration tests in https://github.com/docker/buildx/tree/master/tests if you can or can be follow-up

Thanks!

driver/features.go Show resolved Hide resolved
@n-g
Copy link
Contributor Author

n-g commented Mar 8, 2024

Can you squash your commits please?

Also would be nice to have integration tests in https://github.com/docker/buildx/tree/master/tests if you can or can be follow-up

Thanks!

Sure!

I initially did not realize that not all workers are tested by default with ./hack/test.
Updated the test now, and validated it with
TESTFLAGS="-v --parallel=1 --timeout=30m --run=//worker=docker$" TEST_DOCKERD=1 TESTFLAGS_DOCKER="-v --parallel=1 --timeout=30m" ./hack/test locally.

PTAL

@n-g n-g requested a review from crazy-max March 8, 2024 15:44
tests/build.go Outdated Show resolved Hide resolved
@n-g n-g force-pushed the master branch 2 times, most recently from 2fd4de2 to e8b5973 Compare March 8, 2024 16:22
@n-g n-g requested a review from crazy-max March 8, 2024 16:23
tests/build.go Outdated Show resolved Hide resolved
tests/build.go Outdated Show resolved Hide resolved
@n-g
Copy link
Contributor Author

n-g commented Mar 15, 2024

@crazy-max Could you help me re-trigger the validation workflows?

@n-g
Copy link
Contributor Author

n-g commented Mar 18, 2024

@crazy-max Could you help me re-trigger the validation workflows?

Thanks!
Let me know if there is anything else I can help with here 🙏

crazy-max
crazy-max previously approved these changes Mar 28, 2024
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

It needs a rebase with changes introduced recently sorry 😅
See also review, I tried to push changes to your branch but looks like you don't allow edits by maintainers. Here is my branch if you want to pick these changes: master...crazy-max:buildx:default-load-opt otherwise I can carry in another PR if you prefer. Thanks

tests/build.go Outdated
Comment on lines 680 to 755
if sb.Name() != "docker" {
t.Skip("skipping test for non-docker workers")
}
Copy link
Member

Choose a reason for hiding this comment

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

Use helper, see bcda1db

tests/build.go Outdated
Comment on lines 684 to 763
registry, err := sb.NewRegistry()
if errors.Is(err, integration.ErrRequirements) {
t.Skip(err.Error())
}
require.NoError(t, err)

target := registry + "/buildx/registry:" + identity.NewID()
Copy link
Member

@crazy-max crazy-max Apr 5, 2024

Choose a reason for hiding this comment

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

Setting up registry is not needed for this test, see 4d012cf

@n-g n-g force-pushed the master branch 3 times, most recently from c7012c1 to 58a45d9 Compare April 5, 2024 12:47
@n-g
Copy link
Contributor Author

n-g commented Apr 5, 2024

It needs a rebase with changes introduced recently sorry 😅 See also review, I tried to push changes to your branch but looks like you don't allow edits by maintainers. Here is my branch if you want to pick these changes: master...crazy-max:buildx:default-load-opt otherwise I can carry in another PR if you prefer. Thanks

Thanks!
Rebased and applied your suggestions.

From what I can tell, I cannot grant edit rights retroactively.
Feel free to ping me if you need any changes.

tests/build.go Outdated
Comment on lines 789 to 796
cmd.Env = append(cmd.Env, "BUILDX_BUILDER="+builderName)
outb, err := cmd.CombinedOutput()
require.NoError(t, err, string(outb))
}
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, sorry, bad merge. Was juggling too many things.
Updated and tested locally 🤞

This eases build driver migrations, as it allows aligning the default behavior.
See also https://docs.docker.com/build/drivers/

Signed-off-by: Niklas Gehlen <niklas@namespacelabs.com>
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

Thanks!

@crazy-max crazy-max merged commit 4b3c3c8 into docker:master Apr 5, 2024
67 checks passed
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.

None yet

4 participants