mirror of
https://github.com/mudler/luet.git
synced 2025-09-04 16:50:50 +00:00
🔧 Update modules
This commit is contained in:
2
vendor/github.com/google/go-containerregistry/pkg/crane/append.go
generated
vendored
2
vendor/github.com/google/go-containerregistry/pkg/crane/append.go
generated
vendored
@@ -30,7 +30,7 @@ func Append(base v1.Image, paths ...string) (v1.Image, error) {
|
||||
for _, path := range paths {
|
||||
layer, err := getLayer(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("reading layer %q: %v", path, err)
|
||||
return nil, fmt.Errorf("reading layer %q: %w", path, err)
|
||||
}
|
||||
|
||||
layers = append(layers, layer)
|
||||
|
4
vendor/github.com/google/go-containerregistry/pkg/crane/catalog.go
generated
vendored
4
vendor/github.com/google/go-containerregistry/pkg/crane/catalog.go
generated
vendored
@@ -24,12 +24,12 @@ import (
|
||||
// Catalog returns the repositories in a registry's catalog.
|
||||
func Catalog(src string, opt ...Option) (res []string, err error) {
|
||||
o := makeOptions(opt...)
|
||||
reg, err := name.NewRegistry(src, o.name...)
|
||||
reg, err := name.NewRegistry(src, o.Name...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// This context gets overridden by remote.WithContext, which is set by
|
||||
// crane.WithContext.
|
||||
return remote.Catalog(context.Background(), reg, o.remote...)
|
||||
return remote.Catalog(context.Background(), reg, o.Remote...)
|
||||
}
|
||||
|
32
vendor/github.com/google/go-containerregistry/pkg/crane/copy.go
generated
vendored
32
vendor/github.com/google/go-containerregistry/pkg/crane/copy.go
generated
vendored
@@ -27,62 +27,62 @@ import (
|
||||
// Copy copies a remote image or index from src to dst.
|
||||
func Copy(src, dst string, opt ...Option) error {
|
||||
o := makeOptions(opt...)
|
||||
srcRef, err := name.ParseReference(src, o.name...)
|
||||
srcRef, err := name.ParseReference(src, o.Name...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing reference %q: %v", src, err)
|
||||
return fmt.Errorf("parsing reference %q: %w", src, err)
|
||||
}
|
||||
|
||||
dstRef, err := name.ParseReference(dst, o.name...)
|
||||
dstRef, err := name.ParseReference(dst, o.Name...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing reference for %q: %v", dst, err)
|
||||
return fmt.Errorf("parsing reference for %q: %w", dst, err)
|
||||
}
|
||||
|
||||
logs.Progress.Printf("Copying from %v to %v", srcRef, dstRef)
|
||||
desc, err := remote.Get(srcRef, o.remote...)
|
||||
desc, err := remote.Get(srcRef, o.Remote...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("fetching %q: %v", src, err)
|
||||
return fmt.Errorf("fetching %q: %w", src, err)
|
||||
}
|
||||
|
||||
switch desc.MediaType {
|
||||
case types.OCIImageIndex, types.DockerManifestList:
|
||||
// Handle indexes separately.
|
||||
if o.platform != nil {
|
||||
if o.Platform != nil {
|
||||
// If platform is explicitly set, don't copy the whole index, just the appropriate image.
|
||||
if err := copyImage(desc, dstRef, o); err != nil {
|
||||
return fmt.Errorf("failed to copy image: %v", err)
|
||||
return fmt.Errorf("failed to copy image: %w", err)
|
||||
}
|
||||
} else {
|
||||
if err := copyIndex(desc, dstRef, o); err != nil {
|
||||
return fmt.Errorf("failed to copy index: %v", err)
|
||||
return fmt.Errorf("failed to copy index: %w", err)
|
||||
}
|
||||
}
|
||||
case types.DockerManifestSchema1, types.DockerManifestSchema1Signed:
|
||||
// Handle schema 1 images separately.
|
||||
if err := legacy.CopySchema1(desc, srcRef, dstRef, o.remote...); err != nil {
|
||||
return fmt.Errorf("failed to copy schema 1 image: %v", err)
|
||||
if err := legacy.CopySchema1(desc, srcRef, dstRef, o.Remote...); err != nil {
|
||||
return fmt.Errorf("failed to copy schema 1 image: %w", err)
|
||||
}
|
||||
default:
|
||||
// Assume anything else is an image, since some registries don't set mediaTypes properly.
|
||||
if err := copyImage(desc, dstRef, o); err != nil {
|
||||
return fmt.Errorf("failed to copy image: %v", err)
|
||||
return fmt.Errorf("failed to copy image: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func copyImage(desc *remote.Descriptor, dstRef name.Reference, o options) error {
|
||||
func copyImage(desc *remote.Descriptor, dstRef name.Reference, o Options) error {
|
||||
img, err := desc.Image()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return remote.Write(dstRef, img, o.remote...)
|
||||
return remote.Write(dstRef, img, o.Remote...)
|
||||
}
|
||||
|
||||
func copyIndex(desc *remote.Descriptor, dstRef name.Reference, o options) error {
|
||||
func copyIndex(desc *remote.Descriptor, dstRef name.Reference, o Options) error {
|
||||
idx, err := desc.ImageIndex()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return remote.WriteIndex(dstRef, idx, o.remote...)
|
||||
return remote.WriteIndex(dstRef, idx, o.Remote...)
|
||||
}
|
||||
|
6
vendor/github.com/google/go-containerregistry/pkg/crane/delete.go
generated
vendored
6
vendor/github.com/google/go-containerregistry/pkg/crane/delete.go
generated
vendored
@@ -24,10 +24,10 @@ import (
|
||||
// Delete deletes the remote reference at src.
|
||||
func Delete(src string, opt ...Option) error {
|
||||
o := makeOptions(opt...)
|
||||
ref, err := name.ParseReference(src, o.name...)
|
||||
ref, err := name.ParseReference(src, o.Name...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing reference %q: %v", src, err)
|
||||
return fmt.Errorf("parsing reference %q: %w", src, err)
|
||||
}
|
||||
|
||||
return remote.Delete(ref, o.remote...)
|
||||
return remote.Delete(ref, o.Remote...)
|
||||
}
|
||||
|
2
vendor/github.com/google/go-containerregistry/pkg/crane/digest.go
generated
vendored
2
vendor/github.com/google/go-containerregistry/pkg/crane/digest.go
generated
vendored
@@ -19,7 +19,7 @@ import "github.com/google/go-containerregistry/pkg/logs"
|
||||
// Digest returns the sha256 hash of the remote image at ref.
|
||||
func Digest(ref string, opt ...Option) (string, error) {
|
||||
o := makeOptions(opt...)
|
||||
if o.platform != nil {
|
||||
if o.Platform != nil {
|
||||
desc, err := getManifest(ref, opt...)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
18
vendor/github.com/google/go-containerregistry/pkg/crane/get.go
generated
vendored
18
vendor/github.com/google/go-containerregistry/pkg/crane/get.go
generated
vendored
@@ -24,33 +24,33 @@ import (
|
||||
|
||||
func getImage(r string, opt ...Option) (v1.Image, name.Reference, error) {
|
||||
o := makeOptions(opt...)
|
||||
ref, err := name.ParseReference(r, o.name...)
|
||||
ref, err := name.ParseReference(r, o.Name...)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("parsing reference %q: %v", r, err)
|
||||
return nil, nil, fmt.Errorf("parsing reference %q: %w", r, err)
|
||||
}
|
||||
img, err := remote.Image(ref, o.remote...)
|
||||
img, err := remote.Image(ref, o.Remote...)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("reading image %q: %v", ref, err)
|
||||
return nil, nil, fmt.Errorf("reading image %q: %w", ref, err)
|
||||
}
|
||||
return img, ref, nil
|
||||
}
|
||||
|
||||
func getManifest(r string, opt ...Option) (*remote.Descriptor, error) {
|
||||
o := makeOptions(opt...)
|
||||
ref, err := name.ParseReference(r, o.name...)
|
||||
ref, err := name.ParseReference(r, o.Name...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parsing reference %q: %v", r, err)
|
||||
return nil, fmt.Errorf("parsing reference %q: %w", r, err)
|
||||
}
|
||||
return remote.Get(ref, o.remote...)
|
||||
return remote.Get(ref, o.Remote...)
|
||||
}
|
||||
|
||||
// Head performs a HEAD request for a manifest and returns a content descriptor
|
||||
// based on the registry's response.
|
||||
func Head(r string, opt ...Option) (*v1.Descriptor, error) {
|
||||
o := makeOptions(opt...)
|
||||
ref, err := name.ParseReference(r, o.name...)
|
||||
ref, err := name.ParseReference(r, o.Name...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return remote.Head(ref, o.remote...)
|
||||
return remote.Head(ref, o.Remote...)
|
||||
}
|
||||
|
6
vendor/github.com/google/go-containerregistry/pkg/crane/list.go
generated
vendored
6
vendor/github.com/google/go-containerregistry/pkg/crane/list.go
generated
vendored
@@ -24,10 +24,10 @@ import (
|
||||
// ListTags returns the tags in repository src.
|
||||
func ListTags(src string, opt ...Option) ([]string, error) {
|
||||
o := makeOptions(opt...)
|
||||
repo, err := name.NewRepository(src, o.name...)
|
||||
repo, err := name.NewRepository(src, o.Name...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parsing repo %q: %v", src, err)
|
||||
return nil, fmt.Errorf("parsing repo %q: %w", src, err)
|
||||
}
|
||||
|
||||
return remote.List(repo, o.remote...)
|
||||
return remote.List(repo, o.Remote...)
|
||||
}
|
||||
|
2
vendor/github.com/google/go-containerregistry/pkg/crane/manifest.go
generated
vendored
2
vendor/github.com/google/go-containerregistry/pkg/crane/manifest.go
generated
vendored
@@ -21,7 +21,7 @@ func Manifest(ref string, opt ...Option) ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
o := makeOptions(opt...)
|
||||
if o.platform != nil {
|
||||
if o.Platform != nil {
|
||||
img, err := desc.Image()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
28
vendor/github.com/google/go-containerregistry/pkg/crane/optimize.go
generated
vendored
28
vendor/github.com/google/go-containerregistry/pkg/crane/optimize.go
generated
vendored
@@ -34,33 +34,33 @@ import (
|
||||
func Optimize(src, dst string, prioritize []string, opt ...Option) error {
|
||||
pset := newStringSet(prioritize)
|
||||
o := makeOptions(opt...)
|
||||
srcRef, err := name.ParseReference(src, o.name...)
|
||||
srcRef, err := name.ParseReference(src, o.Name...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing reference %q: %v", src, err)
|
||||
return fmt.Errorf("parsing reference %q: %w", src, err)
|
||||
}
|
||||
|
||||
dstRef, err := name.ParseReference(dst, o.name...)
|
||||
dstRef, err := name.ParseReference(dst, o.Name...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing reference for %q: %v", dst, err)
|
||||
return fmt.Errorf("parsing reference for %q: %w", dst, err)
|
||||
}
|
||||
|
||||
logs.Progress.Printf("Optimizing from %v to %v", srcRef, dstRef)
|
||||
desc, err := remote.Get(srcRef, o.remote...)
|
||||
desc, err := remote.Get(srcRef, o.Remote...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("fetching %q: %v", src, err)
|
||||
return fmt.Errorf("fetching %q: %w", src, err)
|
||||
}
|
||||
|
||||
switch desc.MediaType {
|
||||
case types.OCIImageIndex, types.DockerManifestList:
|
||||
// Handle indexes separately.
|
||||
if o.platform != nil {
|
||||
if o.Platform != nil {
|
||||
// If platform is explicitly set, don't optimize the whole index, just the appropriate image.
|
||||
if err := optimizeAndPushImage(desc, dstRef, pset, o); err != nil {
|
||||
return fmt.Errorf("failed to optimize image: %v", err)
|
||||
return fmt.Errorf("failed to optimize image: %w", err)
|
||||
}
|
||||
} else {
|
||||
if err := optimizeAndPushIndex(desc, dstRef, pset, o); err != nil {
|
||||
return fmt.Errorf("failed to optimize index: %v", err)
|
||||
return fmt.Errorf("failed to optimize index: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,14 +70,14 @@ func Optimize(src, dst string, prioritize []string, opt ...Option) error {
|
||||
default:
|
||||
// Assume anything else is an image, since some registries don't set mediaTypes properly.
|
||||
if err := optimizeAndPushImage(desc, dstRef, pset, o); err != nil {
|
||||
return fmt.Errorf("failed to optimize image: %v", err)
|
||||
return fmt.Errorf("failed to optimize image: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func optimizeAndPushImage(desc *remote.Descriptor, dstRef name.Reference, prioritize stringSet, o options) error {
|
||||
func optimizeAndPushImage(desc *remote.Descriptor, dstRef name.Reference, prioritize stringSet, o Options) error {
|
||||
img, err := desc.Image()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -92,7 +92,7 @@ func optimizeAndPushImage(desc *remote.Descriptor, dstRef name.Reference, priori
|
||||
return fmt.Errorf("the following prioritized files were missing from image: %v", missing.List())
|
||||
}
|
||||
|
||||
return remote.Write(dstRef, oimg, o.remote...)
|
||||
return remote.Write(dstRef, oimg, o.Remote...)
|
||||
}
|
||||
|
||||
func optimizeImage(img v1.Image, prioritize stringSet) (stringSet, v1.Image, error) {
|
||||
@@ -142,7 +142,7 @@ func optimizeImage(img v1.Image, prioritize stringSet) (stringSet, v1.Image, err
|
||||
return missingFromImage, oimg, nil
|
||||
}
|
||||
|
||||
func optimizeAndPushIndex(desc *remote.Descriptor, dstRef name.Reference, prioritize stringSet, o options) error {
|
||||
func optimizeAndPushIndex(desc *remote.Descriptor, dstRef name.Reference, prioritize stringSet, o Options) error {
|
||||
idx, err := desc.ImageIndex()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -157,7 +157,7 @@ func optimizeAndPushIndex(desc *remote.Descriptor, dstRef name.Reference, priori
|
||||
return fmt.Errorf("the following prioritized files were missing from all images: %v", missing.List())
|
||||
}
|
||||
|
||||
return remote.WriteIndex(dstRef, oidx, o.remote...)
|
||||
return remote.WriteIndex(dstRef, oidx, o.Remote...)
|
||||
}
|
||||
|
||||
func optimizeIndex(idx v1.ImageIndex, prioritize stringSet) (stringSet, v1.ImageIndex, error) {
|
||||
|
55
vendor/github.com/google/go-containerregistry/pkg/crane/options.go
generated
vendored
55
vendor/github.com/google/go-containerregistry/pkg/crane/options.go
generated
vendored
@@ -24,15 +24,24 @@ import (
|
||||
"github.com/google/go-containerregistry/pkg/v1/remote"
|
||||
)
|
||||
|
||||
type options struct {
|
||||
name []name.Option
|
||||
remote []remote.Option
|
||||
platform *v1.Platform
|
||||
// Options hold the options that crane uses when calling other packages.
|
||||
type Options struct {
|
||||
Name []name.Option
|
||||
Remote []remote.Option
|
||||
Platform *v1.Platform
|
||||
}
|
||||
|
||||
func makeOptions(opts ...Option) options {
|
||||
opt := options{
|
||||
remote: []remote.Option{
|
||||
// GetOptions exposes the underlying []remote.Option, []name.Option, and
|
||||
// platform, based on the passed Option. Generally, you shouldn't need to use
|
||||
// this unless you've painted yourself into a dependency corner as we have
|
||||
// with the crane and gcrane cli packages.
|
||||
func GetOptions(opts ...Option) Options {
|
||||
return makeOptions(opts...)
|
||||
}
|
||||
|
||||
func makeOptions(opts ...Option) Options {
|
||||
opt := Options{
|
||||
Remote: []remote.Option{
|
||||
remote.WithAuthFromKeychain(authn.DefaultKeychain),
|
||||
},
|
||||
}
|
||||
@@ -43,28 +52,28 @@ func makeOptions(opts ...Option) options {
|
||||
}
|
||||
|
||||
// Option is a functional option for crane.
|
||||
type Option func(*options)
|
||||
type Option func(*Options)
|
||||
|
||||
// WithTransport is a functional option for overriding the default transport
|
||||
// for remote operations.
|
||||
func WithTransport(t http.RoundTripper) Option {
|
||||
return func(o *options) {
|
||||
o.remote = append(o.remote, remote.WithTransport(t))
|
||||
return func(o *Options) {
|
||||
o.Remote = append(o.Remote, remote.WithTransport(t))
|
||||
}
|
||||
}
|
||||
|
||||
// Insecure is an Option that allows image references to be fetched without TLS.
|
||||
func Insecure(o *options) {
|
||||
o.name = append(o.name, name.Insecure)
|
||||
func Insecure(o *Options) {
|
||||
o.Name = append(o.Name, name.Insecure)
|
||||
}
|
||||
|
||||
// WithPlatform is an Option to specify the platform.
|
||||
func WithPlatform(platform *v1.Platform) Option {
|
||||
return func(o *options) {
|
||||
return func(o *Options) {
|
||||
if platform != nil {
|
||||
o.remote = append(o.remote, remote.WithPlatform(*platform))
|
||||
o.Remote = append(o.Remote, remote.WithPlatform(*platform))
|
||||
}
|
||||
o.platform = platform
|
||||
o.Platform = platform
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,9 +83,9 @@ func WithPlatform(platform *v1.Platform) Option {
|
||||
//
|
||||
// By default, crane will use authn.DefaultKeychain.
|
||||
func WithAuthFromKeychain(keys authn.Keychain) Option {
|
||||
return func(o *options) {
|
||||
return func(o *Options) {
|
||||
// Replace the default keychain at position 0.
|
||||
o.remote[0] = remote.WithAuthFromKeychain(keys)
|
||||
o.Remote[0] = remote.WithAuthFromKeychain(keys)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,23 +94,23 @@ func WithAuthFromKeychain(keys authn.Keychain) Option {
|
||||
//
|
||||
// By default, crane will use authn.DefaultKeychain.
|
||||
func WithAuth(auth authn.Authenticator) Option {
|
||||
return func(o *options) {
|
||||
return func(o *Options) {
|
||||
// Replace the default keychain at position 0.
|
||||
o.remote[0] = remote.WithAuth(auth)
|
||||
o.Remote[0] = remote.WithAuth(auth)
|
||||
}
|
||||
}
|
||||
|
||||
// WithUserAgent adds the given string to the User-Agent header for any HTTP
|
||||
// requests.
|
||||
func WithUserAgent(ua string) Option {
|
||||
return func(o *options) {
|
||||
o.remote = append(o.remote, remote.WithUserAgent(ua))
|
||||
return func(o *Options) {
|
||||
o.Remote = append(o.Remote, remote.WithUserAgent(ua))
|
||||
}
|
||||
}
|
||||
|
||||
// WithContext is a functional option for setting the context.
|
||||
func WithContext(ctx context.Context) Option {
|
||||
return func(o *options) {
|
||||
o.remote = append(o.remote, remote.WithContext(ctx))
|
||||
return func(o *Options) {
|
||||
o.Remote = append(o.Remote, remote.WithContext(ctx))
|
||||
}
|
||||
}
|
||||
|
19
vendor/github.com/google/go-containerregistry/pkg/crane/pull.go
generated
vendored
19
vendor/github.com/google/go-containerregistry/pkg/crane/pull.go
generated
vendored
@@ -35,12 +35,12 @@ const iWasADigestTag = "i-was-a-digest"
|
||||
// Pull returns a v1.Image of the remote image src.
|
||||
func Pull(src string, opt ...Option) (v1.Image, error) {
|
||||
o := makeOptions(opt...)
|
||||
ref, err := name.ParseReference(src, o.name...)
|
||||
ref, err := name.ParseReference(src, o.Name...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parsing reference %q: %v", src, err)
|
||||
return nil, fmt.Errorf("parsing reference %q: %w", src, err)
|
||||
}
|
||||
|
||||
return remote.Image(ref, o.remote...)
|
||||
return remote.Image(ref, o.Remote...)
|
||||
}
|
||||
|
||||
// Save writes the v1.Image img as a tarball at path with tag src.
|
||||
@@ -50,13 +50,14 @@ func Save(img v1.Image, src, path string) error {
|
||||
}
|
||||
|
||||
// MultiSave writes collection of v1.Image img with tag as a tarball.
|
||||
func MultiSave(imgMap map[string]v1.Image, path string) error {
|
||||
func MultiSave(imgMap map[string]v1.Image, path string, opt ...Option) error {
|
||||
o := makeOptions(opt...)
|
||||
tagToImage := map[name.Tag]v1.Image{}
|
||||
|
||||
for src, img := range imgMap {
|
||||
ref, err := name.ParseReference(src)
|
||||
ref, err := name.ParseReference(src, o.Name...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing ref %q: %v", src, err)
|
||||
return fmt.Errorf("parsing ref %q: %w", src, err)
|
||||
}
|
||||
|
||||
// WriteToFile wants a tag to write to the tarball, but we might have
|
||||
@@ -80,12 +81,12 @@ func MultiSave(imgMap map[string]v1.Image, path string) error {
|
||||
// PullLayer returns the given layer from a registry.
|
||||
func PullLayer(ref string, opt ...Option) (v1.Layer, error) {
|
||||
o := makeOptions(opt...)
|
||||
digest, err := name.NewDigest(ref, o.name...)
|
||||
digest, err := name.NewDigest(ref, o.Name...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return remote.Layer(digest, o.remote...)
|
||||
return remote.Layer(digest, o.Remote...)
|
||||
}
|
||||
|
||||
// SaveLegacy writes the v1.Image img as a legacy tarball at path with tag src.
|
||||
@@ -101,7 +102,7 @@ func MultiSaveLegacy(imgMap map[string]v1.Image, path string) error {
|
||||
for src, img := range imgMap {
|
||||
ref, err := name.ParseReference(src)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing ref %q: %v", src, err)
|
||||
return fmt.Errorf("parsing ref %q: %w", src, err)
|
||||
}
|
||||
refToImage[ref] = img
|
||||
}
|
||||
|
21
vendor/github.com/google/go-containerregistry/pkg/crane/push.go
generated
vendored
21
vendor/github.com/google/go-containerregistry/pkg/crane/push.go
generated
vendored
@@ -36,9 +36,9 @@ func LoadTag(path, tag string, opt ...Option) (v1.Image, error) {
|
||||
}
|
||||
|
||||
o := makeOptions(opt...)
|
||||
t, err := name.NewTag(tag, o.name...)
|
||||
t, err := name.NewTag(tag, o.Name...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parsing tag %q: %v", tag, err)
|
||||
return nil, fmt.Errorf("parsing tag %q: %w", tag, err)
|
||||
}
|
||||
return tarball.ImageFromPath(path, &t)
|
||||
}
|
||||
@@ -46,9 +46,20 @@ func LoadTag(path, tag string, opt ...Option) (v1.Image, error) {
|
||||
// Push pushes the v1.Image img to a registry as dst.
|
||||
func Push(img v1.Image, dst string, opt ...Option) error {
|
||||
o := makeOptions(opt...)
|
||||
tag, err := name.ParseReference(dst, o.name...)
|
||||
tag, err := name.ParseReference(dst, o.Name...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing reference %q: %v", dst, err)
|
||||
return fmt.Errorf("parsing reference %q: %w", dst, err)
|
||||
}
|
||||
return remote.Write(tag, img, o.remote...)
|
||||
return remote.Write(tag, img, o.Remote...)
|
||||
}
|
||||
|
||||
// Upload pushes the v1.Layer to a given repo.
|
||||
func Upload(layer v1.Layer, repo string, opt ...Option) error {
|
||||
o := makeOptions(opt...)
|
||||
ref, err := name.NewRepository(repo, o.Name...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing repo %q: %w", repo, err)
|
||||
}
|
||||
|
||||
return remote.WriteLayer(ref, layer, o.Remote...)
|
||||
}
|
||||
|
10
vendor/github.com/google/go-containerregistry/pkg/crane/tag.go
generated
vendored
10
vendor/github.com/google/go-containerregistry/pkg/crane/tag.go
generated
vendored
@@ -24,16 +24,16 @@ import (
|
||||
// Tag adds tag to the remote img.
|
||||
func Tag(img, tag string, opt ...Option) error {
|
||||
o := makeOptions(opt...)
|
||||
ref, err := name.ParseReference(img, o.name...)
|
||||
ref, err := name.ParseReference(img, o.Name...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing reference %q: %v", img, err)
|
||||
return fmt.Errorf("parsing reference %q: %w", img, err)
|
||||
}
|
||||
desc, err := remote.Get(ref, o.remote...)
|
||||
desc, err := remote.Get(ref, o.Remote...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("fetching %q: %v", img, err)
|
||||
return fmt.Errorf("fetching %q: %w", img, err)
|
||||
}
|
||||
|
||||
dst := ref.Context().Tag(tag)
|
||||
|
||||
return remote.Tag(dst, desc, o.remote...)
|
||||
return remote.Tag(dst, desc, o.Remote...)
|
||||
}
|
||||
|
Reference in New Issue
Block a user