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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add podman buildx version support #16799

Merged
merged 1 commit into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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