mirror of
https://github.com/containers/podman.git
synced 2025-06-23 18:59:30 +08:00
Remove the forceSecure parameter of Image.PushImageTo*
DockerRegistryOptions.DockerInsecureSkipTLSVerify as an types.OptionalBool can now represent that value, so forceSecure is redundant. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
@ -81,7 +81,6 @@ func pushCmd(c *cli.Context) error {
|
||||
var (
|
||||
registryCreds *types.DockerAuthConfig
|
||||
destName string
|
||||
forceSecure bool
|
||||
)
|
||||
|
||||
args := c.Args()
|
||||
@ -150,7 +149,6 @@ func pushCmd(c *cli.Context) error {
|
||||
}
|
||||
if c.IsSet("tls-verify") {
|
||||
dockerRegistryOptions.DockerInsecureSkipTLSVerify = types.NewOptionalBool(!c.BoolT("tls-verify"))
|
||||
forceSecure = c.Bool("tls-verify")
|
||||
}
|
||||
|
||||
so := image.SigningOptions{
|
||||
@ -165,5 +163,5 @@ func pushCmd(c *cli.Context) error {
|
||||
|
||||
authfile := getAuthFile(c.String("authfile"))
|
||||
|
||||
return newImage.PushImageToHeuristicDestination(getContext(), destName, manifestType, authfile, c.String("signature-policy"), writer, c.Bool("compress"), so, &dockerRegistryOptions, forceSecure, nil)
|
||||
return newImage.PushImageToHeuristicDestination(getContext(), destName, manifestType, authfile, c.String("signature-policy"), writer, c.Bool("compress"), so, &dockerRegistryOptions, nil)
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ func saveCmd(c *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := newImage.PushImageToReference(getContext(), destRef, manifestType, "", "", writer, c.Bool("compress"), libpodImage.SigningOptions{}, &libpodImage.DockerRegistryOptions{}, false, additionaltags); err != nil {
|
||||
if err := newImage.PushImageToReference(getContext(), destRef, manifestType, "", "", writer, c.Bool("compress"), libpodImage.SigningOptions{}, &libpodImage.DockerRegistryOptions{}, additionaltags); err != nil {
|
||||
if err2 := os.Remove(output); err2 != nil {
|
||||
logrus.Errorf("error deleting %q: %v", output, err)
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ func (i *Image) UntagImage(tag string) error {
|
||||
|
||||
// PushImageToHeuristicDestination pushes the given image to "destination", which is heuristically parsed.
|
||||
// Use PushImageToReference if the destination is known precisely.
|
||||
func (i *Image) PushImageToHeuristicDestination(ctx context.Context, destination, manifestMIMEType, authFile, signaturePolicyPath string, writer io.Writer, forceCompress bool, signingOptions SigningOptions, dockerRegistryOptions *DockerRegistryOptions, forceSecure bool, additionalDockerArchiveTags []reference.NamedTagged) error {
|
||||
func (i *Image) PushImageToHeuristicDestination(ctx context.Context, destination, manifestMIMEType, authFile, signaturePolicyPath string, writer io.Writer, forceCompress bool, signingOptions SigningOptions, dockerRegistryOptions *DockerRegistryOptions, additionalDockerArchiveTags []reference.NamedTagged) error {
|
||||
if destination == "" {
|
||||
return errors.Wrapf(syscall.EINVAL, "destination image name must be specified")
|
||||
}
|
||||
@ -516,11 +516,11 @@ func (i *Image) PushImageToHeuristicDestination(ctx context.Context, destination
|
||||
return err
|
||||
}
|
||||
}
|
||||
return i.PushImageToReference(ctx, dest, manifestMIMEType, authFile, signaturePolicyPath, writer, forceCompress, signingOptions, dockerRegistryOptions, forceSecure, additionalDockerArchiveTags)
|
||||
return i.PushImageToReference(ctx, dest, manifestMIMEType, authFile, signaturePolicyPath, writer, forceCompress, signingOptions, dockerRegistryOptions, additionalDockerArchiveTags)
|
||||
}
|
||||
|
||||
// PushImageToReference pushes the given image to a location described by the given path
|
||||
func (i *Image) PushImageToReference(ctx context.Context, dest types.ImageReference, manifestMIMEType, authFile, signaturePolicyPath string, writer io.Writer, forceCompress bool, signingOptions SigningOptions, dockerRegistryOptions *DockerRegistryOptions, forceSecure bool, additionalDockerArchiveTags []reference.NamedTagged) error {
|
||||
func (i *Image) PushImageToReference(ctx context.Context, dest types.ImageReference, manifestMIMEType, authFile, signaturePolicyPath string, writer io.Writer, forceCompress bool, signingOptions SigningOptions, dockerRegistryOptions *DockerRegistryOptions, additionalDockerArchiveTags []reference.NamedTagged) error {
|
||||
sc := GetSystemContext(signaturePolicyPath, authFile, forceCompress)
|
||||
|
||||
policyContext, err := getPolicyContext(sc)
|
||||
@ -546,7 +546,7 @@ func (i *Image) PushImageToReference(ctx context.Context, dest types.ImageRefere
|
||||
}
|
||||
registry := reference.Domain(imgRef)
|
||||
|
||||
if util.StringInSlice(registry, insecureRegistries) && !forceSecure {
|
||||
if util.StringInSlice(registry, insecureRegistries) && dockerRegistryOptions.DockerInsecureSkipTLSVerify != types.OptionalBoolFalse {
|
||||
copyOptions.DestinationCtx.DockerInsecureSkipTLSVerify = types.OptionalBoolTrue
|
||||
logrus.Info(fmt.Sprintf("%s is an insecure registry; pushing with tls-verify=false", registry))
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ func (i *LibpodAPI) PushImage(call iopodman.VarlinkCall, name, tag string, tlsVe
|
||||
|
||||
so := image.SigningOptions{}
|
||||
|
||||
if err := newImage.PushImageToHeuristicDestination(getContext(), destname, "", "", "", nil, false, so, &dockerRegistryOptions, false, nil); err != nil {
|
||||
if err := newImage.PushImageToHeuristicDestination(getContext(), destname, "", "", "", nil, false, so, &dockerRegistryOptions, nil); err != nil {
|
||||
return call.ReplyErrorOccurred(err.Error())
|
||||
}
|
||||
return call.ReplyPushImage(newImage.ID())
|
||||
@ -489,7 +489,7 @@ func (i *LibpodAPI) ExportImage(call iopodman.VarlinkCall, name, destination str
|
||||
return err
|
||||
}
|
||||
|
||||
if err := newImage.PushImageToHeuristicDestination(getContext(), destination, "", "", "", nil, compress, image.SigningOptions{}, &image.DockerRegistryOptions{}, false, additionalTags); err != nil {
|
||||
if err := newImage.PushImageToHeuristicDestination(getContext(), destination, "", "", "", nil, compress, image.SigningOptions{}, &image.DockerRegistryOptions{}, additionalTags); err != nil {
|
||||
return call.ReplyErrorOccurred(err.Error())
|
||||
}
|
||||
return call.ReplyExportImage(newImage.ID())
|
||||
|
Reference in New Issue
Block a user