Add podman buildx version support
Fixes: https://github.com/containers/podman/issues/16793 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
859f40a2eb
commit
43e307b84f
|
@ -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
|
||||||
|
}
|
|
@ -43,6 +43,12 @@ VOLUME /a/b/c
|
||||||
VOLUME ['/etc/foo', '/etc/bar']
|
VOLUME ['/etc/foo', '/etc/bar']
|
||||||
EOF
|
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
|
run_podman buildx build --load -t build_test --format=docker $tmpdir
|
||||||
is "$output" ".*COMMIT" "COMMIT seen in log"
|
is "$output" ".*COMMIT" "COMMIT seen in log"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue