Skip to content

build: enable platform flag for build if buildkit - #1740

Merged
thaJeztah merged 1 commit into
docker:masterfrom
tonistiigi:platform-flag
Mar 18, 2019
Merged

build: enable platform flag for build if buildkit#1740
thaJeztah merged 1 commit into
docker:masterfrom
tonistiigi:platform-flag

Conversation

@tonistiigi

Copy link
Copy Markdown
Member

Platform flag is supported if BuildKit is being used. If not (lcow) then I left it for the old behavior. I don't think we want to move this flag out of experimental for other commands like pull and run cause their implementation will change with future containerd storage integration.

@tiborvass

Signed-off-by: Tonis Tiigi tonistiigi@gmail.com

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #1740 into master will decrease coverage by <.01%.
The diff coverage is 57.14%.

@@ Coverage Diff @@## master #1740 +/- ##
==========================================
- Coverage 56.04% 56.04% -0.01% 
==========================================
Files 306 306 Lines 21050 21056 +6 ==========================================
+ Hits 11798 11801 +3 - Misses 8399 8400 +1 - Partials 853 855 +2

@codecov-io

codecov-io commented Mar 16, 2019

Copy link
Copy Markdown

Codecov Report

Merging #1740 into master will decrease coverage by 0.22%.
The diff coverage is 57.14%.

@@ Coverage Diff @@## master #1740 +/- ##
==========================================
- Coverage 56.27% 56.04% -0.23% 
==========================================
Files 307 306 -1 Lines 21131 21056 -75 ==========================================
- Hits 11891 11801 -90 - Misses 8377 8400 +23 + Partials 863 855 -8

command.AddTrustVerificationFlags(flags, &options.untrusted, dockerCli.ContentTrustEnabled())
command.AddPlatformFlag(flags, &options.platform)

flags.StringVar(&options.platform, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Added. Note that this PR does not add this env, but just moves around the code.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

@thaJeztahthaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
thaJeztah merged commit 8c3a619 into docker:masterMar 18, 2019
@GordonTheTurtleGordonTheTurtle added this to the 19.03.0 milestone Mar 18, 2019

flags.StringVar(&options.platform, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable")
// Platform is not experimental when BuildKit is used
buildkitEnabled, err := command.BuildKitEnabled(dockerCli.ServerInfo())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is buggy:
When we are creating commands and flags, we have not yet run PersistentPreRun, and so I think the CLI is not yet correctly initialized. I think docker --context=some-context build --platform ... can then have a very wierd behavior (where flag support is evaluated for a daemon that is not the one used after flags are actually parsed)
WDYT @thaJeztah@vdemeester@silvin-lubecki ?

Sign up for freeto 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.

6 participants

@tonistiigi@codecov-io@tiborvass@simonferquel@thaJeztah@GordonTheTurtle