Skip to content

Commit

Permalink
Add podman buildx version support
Browse files Browse the repository at this point in the history
Fixes: containers#16793

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Dec 9, 2022
1 parent 859f40a commit 43e307b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
35 changes: 35 additions & 0 deletions cmd/podman/images/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package images

import (
"fmt"

"github.com/containers/buildah/define"
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/cmd/podman/validate"
"github.com/spf13/cobra"
)

var (
versionDescription = `Print build version`
versionCmd = &cobra.Command{
Use: "version",
Args: validate.NoArgs,
Short: "Print build version",
Long: versionDescription,
RunE: version,
ValidArgsFunction: completion.AutocompleteNone,
}
)

func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: versionCmd,
Parent: buildxCmd,
})
}

func version(cmd *cobra.Command, args []string) error {
fmt.Printf("%s %s\n", define.Package, define.Version)
return nil
}
6 changes: 6 additions & 0 deletions test/system/070-build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ VOLUME /a/b/c
VOLUME ['/etc/foo', '/etc/bar']
EOF

run_podman info --format '{{ .Host.BuildahVersion}}'
BUILDAH_VERSION=$output

run_podman buildx version
is "$output" "buildah ${BUILDAH_VERSION}" "buildx version contains Buildah version"

run_podman buildx build --load -t build_test --format=docker $tmpdir
is "$output" ".*COMMIT" "COMMIT seen in log"

Expand Down

0 comments on commit 43e307b

Please sign in to comment.