summaryrefslogtreecommitdiff
path: root/cmd/podman/push.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/push.go')
-rw-r--r--cmd/podman/push.go17
1 files changed, 6 insertions, 11 deletions
diff --git a/cmd/podman/push.go b/cmd/podman/push.go
index a1ee00a65..bbe8a4027 100644
--- a/cmd/podman/push.go
+++ b/cmd/podman/push.go
@@ -2,8 +2,6 @@ package main
import (
"fmt"
- "github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/spf13/cobra"
"io"
"os"
"strings"
@@ -11,11 +9,13 @@ import (
"github.com/containers/image/directory"
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/containers/libpod/cmd/podman/libpodruntime"
+ "github.com/containers/libpod/cmd/podman/cliconfig"
+ "github.com/containers/libpod/libpod/adapter"
"github.com/containers/libpod/libpod/image"
"github.com/containers/libpod/pkg/util"
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
+ "github.com/spf13/cobra"
)
var (
@@ -40,6 +40,7 @@ var (
func init() {
pushCommand.Command = _pushCommand
+ pushCommand.SetUsageTemplate(UsageTemplate())
flags := pushCommand.Flags()
flags.MarkHidden("signature-policy")
flags.StringVar(&pushCommand.Authfile, "authfile", "", "Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json. Use REGISTRY_AUTH_FILE environment variable to override")
@@ -52,7 +53,6 @@ func init() {
flags.StringVar(&pushCommand.SignaturePolicy, "signature-policy", "", "`Pathname` of signature policy file (not usually used)")
flags.StringVar(&pushCommand.SignBy, "sign-by", "", "Add a signature at the destination using the specified key")
flags.BoolVar(&pushCommand.TlsVerify, "tls-verify", true, "Require HTTPS and verify certificates when contacting registries (default: true)")
- rootCmd.AddCommand(pushCommand.Command)
}
func pushCmd(c *cliconfig.PushValues) error {
@@ -93,7 +93,7 @@ func pushCmd(c *cliconfig.PushValues) error {
registryCreds = creds
}
- runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand)
+ runtime, err := adapter.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "could not create runtime")
}
@@ -131,12 +131,7 @@ func pushCmd(c *cliconfig.PushValues) error {
SignBy: signBy,
}
- newImage, err := runtime.ImageRuntime().NewFromLocal(srcName)
- if err != nil {
- return err
- }
-
authfile := getAuthFile(c.Authfile)
- return newImage.PushImageToHeuristicDestination(getContext(), destName, manifestType, authfile, c.SignaturePolicy, writer, c.Compress, so, &dockerRegistryOptions, nil)
+ return runtime.Push(getContext(), srcName, destName, manifestType, authfile, c.SignaturePolicy, writer, c.Compress, so, &dockerRegistryOptions, nil)
}