summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2021-08-09 20:09:16 +0000
committerGitHub <noreply@github.com>2021-08-09 20:09:16 +0000
commit6513adda185986c1994d2a2d354b874aee7543e6 (patch)
tree1a8e4242386622886caa4786af15417f0ced4821 /cmd/podman
parent431707c72044154b956944d00b1ba40b303decb2 (diff)
parent170fb257295027aeb6410b86e06c38086299d2e3 (diff)
downloadpodman-6513adda185986c1994d2a2d354b874aee7543e6.tar.gz
podman-6513adda185986c1994d2a2d354b874aee7543e6.tar.bz2
podman-6513adda185986c1994d2a2d354b874aee7543e6.zip
Merge pull request #11134 from rhatdan/buildx
Alias build to buildx, so it won't fail
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/images/build.go25
-rw-r--r--cmd/podman/images/buildx.go29
-rw-r--r--cmd/podman/shell_completion_test.go4
3 files changed, 57 insertions, 1 deletions
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go
index 3aeba6fb0..a1a28b809 100644
--- a/cmd/podman/images/build.go
+++ b/cmd/podman/images/build.go
@@ -67,6 +67,18 @@ var (
podman image build --layers --force-rm --tag imageName .`,
}
+ buildxBuildCmd = &cobra.Command{
+ Args: buildCmd.Args,
+ Use: buildCmd.Use,
+ Short: buildCmd.Short,
+ Long: buildCmd.Long,
+ RunE: buildCmd.RunE,
+ ValidArgsFunction: buildCmd.ValidArgsFunction,
+ Example: `podman buildx build .
+ podman buildx build --creds=username:password -t imageName -f Containerfile.simple .
+ podman buildx build --layers --force-rm --tag imageName .`,
+ }
+
buildOpts = buildFlagsWrapper{}
)
@@ -91,11 +103,24 @@ func init() {
Parent: imageCmd,
})
buildFlags(imageBuildCmd)
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Command: buildxBuildCmd,
+ Parent: buildxCmd,
+ })
+ buildFlags(buildxBuildCmd)
}
func buildFlags(cmd *cobra.Command) {
flags := cmd.Flags()
+ // buildx build --load ignored, but added for compliance
+ flags.Bool("load", false, "buildx --load")
+ _ = flags.MarkHidden("load")
+
+ // buildx build --progress ignored, but added for compliance
+ flags.String("progress", "auto", "buildx --progress")
+ _ = flags.MarkHidden("progress")
+
// Podman flags
flags.BoolVarP(&buildOpts.SquashAll, "squash-all", "", false, "Squash all layers into a single layer")
diff --git a/cmd/podman/images/buildx.go b/cmd/podman/images/buildx.go
new file mode 100644
index 000000000..5c8e5aaa0
--- /dev/null
+++ b/cmd/podman/images/buildx.go
@@ -0,0 +1,29 @@
+package images
+
+import (
+ "github.com/containers/podman/v3/cmd/podman/registry"
+ "github.com/containers/podman/v3/cmd/podman/validate"
+ "github.com/spf13/cobra"
+)
+
+var (
+ // Command: podman _buildx_
+ // This is a hidden command, which was added to make converting
+ // from Docker to Podman easier.
+ // For now podman buildx build just calls into podman build
+ // If we are adding new buildx features, we will add them by default
+ // to podman build.
+ buildxCmd = &cobra.Command{
+ Use: "buildx",
+ Short: "Build images",
+ Long: "Build images",
+ RunE: validate.SubCommandExists,
+ Hidden: true,
+ }
+)
+
+func init() {
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Command: buildxCmd,
+ })
+}
diff --git a/cmd/podman/shell_completion_test.go b/cmd/podman/shell_completion_test.go
index 9bd821d8d..792beeb19 100644
--- a/cmd/podman/shell_completion_test.go
+++ b/cmd/podman/shell_completion_test.go
@@ -33,7 +33,9 @@ func TestShellCompletionFunctions(t *testing.T) {
func checkCommand(t *testing.T, cmd *cobra.Command) {
if cmd.HasSubCommands() {
for _, childCmd := range cmd.Commands() {
- checkCommand(t, childCmd)
+ if !childCmd.Hidden {
+ checkCommand(t, childCmd)
+ }
}
// if not check if completion for that command is provided