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

Add buildx build --opt (EXPERIMENTAL) #2260

Closed
wants to merge 1 commit into from

Conversation

AkihiroSuda
Copy link
Collaborator

This allows opt-in to new features of BuildKit that are not officially exposed to buildx yet.

build/build.go Outdated Show resolved Hide resolved
@crazy-max
Copy link
Member

Seems fine if we keep this flag under experimental. Don't think we should move it out in the future?

This could also be useful for bake (can be in follow-up).

If you could add a basic integration test in https://github.com/docker/buildx/blob/master/tests/build.go that checks a frontend attribute being set through opt. Maybe similar to

func testBuildAnnotations(t *testing.T, sb integration.Sandbox) {
that would set an annotation that overrides one set by --annotation?

@AkihiroSuda
Copy link
Collaborator Author

Added tests and bake.

@AkihiroSuda
Copy link
Collaborator Author

Failure seems unrelated?
https://github.com/docker/buildx/actions/runs/7975611949/job/21774316421?pr=2260

#29 [validate-upstream 5/5] RUN htmltest
#29 0.066 htmltest started at 03:09:57 on public
#29 0.066 ========================================================================
#29 6.066 engine/reference/commandline/buildx_imagetools/index.html
#29 6.066   target does not exist --- engine/reference/commandline/buildx_imagetools/index.html --> /reference/cli/docker/buildx/#builder
#29 6.066 engine/reference/commandline/buildx_create/index.html
#29 6.081   target does not exist --- engine/reference/commandline/buildx_create/index.html --> /reference/cli/docker/buildx/build/#load
#29 6.081   target does not exist --- engine/reference/commandline/buildx_create/index.html --> /reference/cli/docker/buildx/build/#load
#29 6.081   target does not exist --- engine/reference/commandline/buildx_create/index.html --> /reference/cli/docker/buildx/build/#load
#29 6.081   target does not exist --- engine/reference/commandline/buildx_create/index.html --> /reference/cli/docker/buildx/build/#load
#29 6.081 engine/reference/commandline/buildx_inspect/index.html
#29 6.111   target does not exist --- engine/reference/commandline/buildx_inspect/index.html --> /reference/cli/docker/buildx/#builder
#29 6.111 engine/reference/commandline/buildx_use/index.html
#29 6.[352](https://github.com/docker/buildx/actions/runs/7975611949/job/21774316421?pr=2260#step:6:358)   target does not exist --- engine/reference/commandline/buildx_use/index.html --> /reference/cli/docker/buildx/#builder
#29 6.352 engine/reference/commandline/buildx_debug_build/index.html
#29 6.383   target does not exist --- engine/reference/commandline/buildx_debug_build/index.html --> /reference/cli/docker/image/build/#add-host
#29 6.383   target does not exist --- engine/reference/commandline/buildx_debug_build/index.html --> /reference/cli/docker/image/build/#cgroup-parent
#29 6.383   target does not exist --- engine/reference/commandline/buildx_debug_build/index.html --> /reference/cli/docker/image/build/#file
#29 6.383   target does not exist --- engine/reference/commandline/buildx_debug_build/index.html --> /reference/cli/docker/image/build/#tag
#29 6.383   target does not exist --- engine/reference/commandline/buildx_debug_build/index.html --> /reference/cli/docker/image/build/#target
#29 6.383 engine/reference/commandline/buildx_rm/index.html
#29 6.558   target does not exist --- engine/reference/commandline/buildx_rm/index.html --> /reference/cli/docker/buildx/#builder
#29 6.558 engine/reference/commandline/buildx_imagetools_create/index.html
#29 6.618   target does not exist --- engine/reference/commandline/buildx_imagetools_create/index.html --> /reference/cli/docker/buildx/#builder
#29 6.618 engine/reference/commandline/buildx_stop/index.html
#29 6.642   target does not exist --- engine/reference/commandline/buildx_stop/index.html --> /reference/cli/docker/buildx/#builder
#29 6.642 engine/reference/commandline/buildx_prune/index.html
#29 6.880   target does not exist --- engine/reference/commandline/buildx_prune/index.html --> /reference/cli/docker/buildx/#builder
#29 6.880 engine/reference/commandline/buildx_bake/index.html
#29 7.560   target does not exist --- engine/reference/commandline/buildx_bake/index.html --> /reference/cli/docker/buildx/#builder
#29 7.560   target does not exist --- engine/reference/commandline/buildx_bake/index.html --> /reference/cli/docker/buildx/build/#progress
#29 7.560   target does not exist --- engine/reference/commandline/buildx_bake/index.html --> /reference/cli/docker/buildx/build/#provenance
#29 7.560   target does not exist --- engine/reference/commandline/buildx_bake/index.html --> /reference/cli/docker/buildx/build/#sbom
#29 7.560 engine/reference/commandline/buildx_imagetools_inspect/index.html
#29 7.716   target does not exist --- engine/reference/commandline/buildx_imagetools_inspect/index.html --> /reference/cli/docker/buildx/#builder
#29 7.716 engine/reference/commandline/buildx_build/index.html
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/cli/docker/image/build/
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/cli/docker/image/build/#add-host
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/cli/docker/image/build/#cgroup-parent
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/cli/docker/image/build/#file
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/cli/docker/image/build/#tag
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/cli/docker/image/build/#target
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/dockerfile/#run---securitysandbox
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/cli/docker/buildx/create/#buildkitd-flags
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/cli/docker/image/build/#build-arg
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/dockerfile/#buildkit-built-in-build-args
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/cli/docker/buildx/#builder
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/dockerfile/#automatic-platform-args-in-the-global-scope
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/dockerfile/#run---mounttypesecret
#29 8.107   target does not exist --- engine/reference/commandline/buildx_build/index.html --> /reference/dockerfile/#run---mounttypessh
#29 8.107 ========================================================================
#29 10.51 ✘✘✘ failed in 10.442016513s
#29 10.51 35 errors in 2083 documents
#29 10.51 
#29 ERROR: process "/bin/sh -c htmltest" did not complete successfully: exit code: 1

@crazy-max
Copy link
Member

Failure seems unrelated? https://github.com/docker/buildx/actions/runs/7975611949/job/21774316421?pr=2260

Yes this is linked to #2253 and will be fixed when changes are made on docs repo (cc @dvdksn)

@tonistiigi
Copy link
Member

I'm not sure if we want this. Buildx uses opinionated UX and strictly defined flags/types. Allowing to set raw buildkit values directly adds confusion and makes it easier to make mistakes - pass wrong values and get to undefined configuration combinations. Definitely not as --opt as the meaning is more "raw buildkit frontend config option".

@AkihiroSuda
Copy link
Collaborator Author

I'm not sure if we want this. Buildx uses opinionated UX and strictly defined flags/types. Allowing to set raw buildkit values directly adds confusion and makes it easier to make mistakes - pass wrong values and get to undefined configuration combinations. Definitely not as --opt as the meaning is more "raw buildkit frontend config option".

This will remain experimental forever, so this will not confuse non-expert users.

If this is still not acceptable as an arg, can we implement this as an env var that takes a JSON of []string?

@tonistiigi tonistiigi removed this from the v0.13.0 milestone Feb 23, 2024
This allows opt-in to new features of BuildKit that are not officially
exposed to buildx yet.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@colinhemmings
Copy link
Collaborator

Hi there, I agree with Tonis on this one. I'm concerned about the user experience of enabling this kind of backdoor through to Buildkit. It's confusing for users and leads to a support overhead further down the line. I know this would be experimental, but people would start using it and then get annoyed when we removed it or stopped supporting it. We already get backlash from users regarding legacy builder functionality, which has been dropped from Buildkit.
If there are specific features/use cases that are not available via Buildx, we should consider and implement those. That way, all users benefit from them with proper tested support.

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.

4 participants