Skip to content

Commit 51a0914

Browse files
Merge pull request #2842 from thaJeztah/platform_experimental
build: remove PersistentPreRunE hack for experimental --platform
2 parents a7150fc + e3d9305 commit 51a0914

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

cli/command/image/build.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -113,25 +113,6 @@ func NewBuildCommand(dockerCli command.Cli) *cobra.Command {
113113
},
114114
}
115115

116-
// Wrap the global pre-run to handle non-BuildKit use of the --platform flag.
117-
//
118-
// We're doing it here so that we're only contacting the daemon when actually
119-
// running the command, and not during initialization.
120-
// TODO remove this hack once we no longer support the experimental use of --platform
121-
rootFn := cmd.Root().PersistentPreRunE
122-
cmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
123-
if ok, _ := command.BuildKitEnabled(dockerCli.ServerInfo()); !ok {
124-
f := cmd.Flag("platform")
125-
delete(f.Annotations, "buildkit")
126-
f.Annotations["version"] = []string{"1.32"}
127-
f.Annotations["experimental"] = nil
128-
}
129-
if rootFn != nil {
130-
return rootFn(cmd, args)
131-
}
132-
return nil
133-
}
134-
135116
flags := cmd.Flags()
136117

137118
flags.VarP(&options.tags, "tag", "t", "Name and optionally a tag in the 'name:tag' format")

cli/command/utils.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ func PruneFilters(dockerCli Cli, pruneFilters filters.Args) filters.Args {
125125
func AddPlatformFlag(flags *pflag.FlagSet, target *string) {
126126
flags.StringVar(target, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable")
127127
flags.SetAnnotation("platform", "version", []string{"1.32"})
128-
flags.SetAnnotation("platform", "experimental", nil)
129128
}
130129

131130
// ValidateOutputPath validates the output paths of the `export` and `save` commands.

0 commit comments

Comments
 (0)