The Wayback Machine - https://web.archive.org/web/20240627123003/https://github.com/docker/cli/pull/5178
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: allow BuildKit to be used on Windows daemons that advertise it #5178

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

thaJeztah
Copy link
Member

build: allow BuildKit to be used on Windows daemons that advertise it

Commit 6fef143 switched the CLI to use
BuildKit by default, but as part of that removed the use of the
BuildkitVersion field as returned by Ping.

Some follow-up changes in commits e38e6c5 and
e7a8748 updated the logic for detecting whether
BuildKit should be used or the legacy builder, but hard-coded using the
legacy builder for Windows daemons.

While Windows / WCOW does not yet support BuildKit by default, there is
work in progress to implement it, so we should not hard-code the assumption
that a Windows daemon cannot support BuildKit.

On the daemon-side, moby@7b153b9 (Docker v23.0) changed the default as
advertised by the daemon to be BuildKit for Linux daemons. That change
still hardcoded BuildKit to be unsupported for Windows daemons (and does
not yet allow overriding the config), but this may change for future
versions of the daemon, or test-builds.

This patch:

  • Re-introduces checks for the BuildkitVersion field in the "Ping" response.
  • If the Ping response from the daemon advertises that it supports BuildKit,
    the CLI will now use BuildKit as builder.
  • If we didn't get a Ping response, or the Ping response did NOT advertise
    that the daemon supported BuildKit, we continue to use the current
    defaults (BuildKit for Linux daemons, and the legacy builder for Windows)
  • Handling of the DOCKER_BUILDKIT environment variable is unchanged; for
    CLI.BuildKitEnabled, DOCKER_BUILDKIT always takes precedence, and for
    processBuilder the value is taken into account, but will print a warning
    when BuildKit is disabled and a Linux daemon is used. For Windows daemons,
    no warning is printed.

- Description for the changelog

build: allow BuildKit to be used on Windows daemons that advertise it

- A picture of a cute animal (not mandatory but encouraged)

Commit 6fef143 switched the CLI to use
BuildKit by default, but as part of that removed the use of the
BuildkitVersion field as returned by Ping.

Some follow-up changes in commits e38e6c5 and
e7a8748 updated the logic for detecting whether
BuildKit should be used or the legacy builder, but hard-coded using the
legacy builder for Windows daemons.

While Windows / WCOW does not yet support BuildKit by default, there is
work in progress to implement it, so we should not hard-code the assumption
that a Windows daemon cannot support BuildKit.

On the daemon-side, [moby@7b153b9] (Docker v23.0) changed the default as
advertised by the daemon to be BuildKit for Linux daemons. That change
still hardcoded BuildKit to be unsupported for Windows daemons (and does
not yet allow overriding the config), but this may change for future
versions of the daemon, or test-builds.

This patch:

- Re-introduces checks for the BuildkitVersion field in the "Ping" response.
- If the Ping response from the daemon advertises that it supports BuildKit,
  the CLI will now use BuildKit as builder.
- If we didn't get a Ping response, or the Ping response did NOT advertise
  that the daemon supported BuildKit, we continue to use the current
  defaults (BuildKit for Linux daemons, and the legacy builder for Windows)
- Handling of the DOCKER_BUILDKIT environment variable is unchanged; for
  CLI.BuildKitEnabled, DOCKER_BUILDKIT always takes precedence, and for
  processBuilder the value is taken into account, but will print a warning
  when BuildKit is disabled and a Linux daemon is used. For Windows daemons,
  no warning is printed.

[moby@7b153b9]: moby/moby@7b153b9

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.

Project coverage is 61.73%. Comparing base (64206ae) to head (e5d26a8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5178      +/-   ##
==========================================
- Coverage   61.76%   61.73%   -0.04%     
==========================================
  Files         297      294       -3     
  Lines       20768    20767       -1     
==========================================
- Hits        12828    12820       -8     
- Misses       7024     7029       +5     
- Partials      916      918       +2     

Copy link
Contributor

@krissetto krissetto 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 for the thorough context

@thaJeztah
Copy link
Member Author

@crazy-max @colinhemmings PTAL - please double check this change

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.

Yes LGTM so it makes it easier for testing WCOW

@thaJeztah thaJeztah merged commit b83cf58 into docker:master Jun 20, 2024
94 checks passed
@thaJeztah thaJeztah deleted the buildkit_windows branch June 20, 2024 16:46
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.

build: don't hardcode classic builder for windows daemons
4 participants