mirror of
https://github.com/containers/skopeo.git
synced 2026-07-14 05:21:15 +00:00
When locating an image for pulling, inspection, or pushing, if we're given an image name that doesn't include a domain/registry, try building a set of candidate names using the configured registries as domains, and then pull/inspect/push using the first of those names that works. If a name that we're given corresponds to a prefix of the ID of a local image, skip completion and use the ID directly instead. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> Closes: #360 Approved by: rhatdan
29 lines
754 B
Go
29 lines
754 B
Go
package buildah
|
|
|
|
import (
|
|
"io"
|
|
|
|
cp "github.com/containers/image/copy"
|
|
"github.com/containers/image/types"
|
|
)
|
|
|
|
func getCopyOptions(reportWriter io.Writer, sourceSystemContext *types.SystemContext, destinationSystemContext *types.SystemContext, manifestType string) *cp.Options {
|
|
return &cp.Options{
|
|
ReportWriter: reportWriter,
|
|
SourceCtx: sourceSystemContext,
|
|
DestinationCtx: destinationSystemContext,
|
|
ForceManifestMIMEType: manifestType,
|
|
}
|
|
}
|
|
|
|
func getSystemContext(defaults *types.SystemContext, signaturePolicyPath string) *types.SystemContext {
|
|
sc := &types.SystemContext{}
|
|
if defaults != nil {
|
|
*sc = *defaults
|
|
}
|
|
if signaturePolicyPath != "" {
|
|
sc.SignaturePolicyPath = signaturePolicyPath
|
|
}
|
|
return sc
|
|
}
|