mirror of
https://github.com/ko-build/ko.git
synced 2025-11-06 09:19:12 +02:00
bump go-containerregistry dep (#404)
This commit is contained in:
2
go.mod
2
go.mod
@@ -11,7 +11,7 @@ require (
|
|||||||
github.com/go-training/helloworld v0.0.0-20200225145412-ba5f4379d78b
|
github.com/go-training/helloworld v0.0.0-20200225145412-ba5f4379d78b
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/google/go-cmp v0.5.6
|
github.com/google/go-cmp v0.5.6
|
||||||
github.com/google/go-containerregistry v0.5.2-0.20210720200529-2f6fbf77f249
|
github.com/google/go-containerregistry v0.6.0
|
||||||
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect
|
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect
|
||||||
github.com/klauspost/compress v1.13.1 // indirect
|
github.com/klauspost/compress v1.13.1 // indirect
|
||||||
github.com/mattmoor/dep-notify v0.0.0-20190205035814-a45dec370a17
|
github.com/mattmoor/dep-notify v0.0.0-20190205035814-a45dec370a17
|
||||||
|
|||||||
2
go.sum
2
go.sum
@@ -389,6 +389,8 @@ github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
|
|||||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-containerregistry v0.5.2-0.20210720200529-2f6fbf77f249 h1:vWUL43oVb6y5SS/wXSYirEZZTonXoKn+ac/hUh/QB+U=
|
github.com/google/go-containerregistry v0.5.2-0.20210720200529-2f6fbf77f249 h1:vWUL43oVb6y5SS/wXSYirEZZTonXoKn+ac/hUh/QB+U=
|
||||||
github.com/google/go-containerregistry v0.5.2-0.20210720200529-2f6fbf77f249/go.mod h1:euCCtNbZ6tKqi1E72vwDj2xZcN5ttKpZLfa/wSo5iLw=
|
github.com/google/go-containerregistry v0.5.2-0.20210720200529-2f6fbf77f249/go.mod h1:euCCtNbZ6tKqi1E72vwDj2xZcN5ttKpZLfa/wSo5iLw=
|
||||||
|
github.com/google/go-containerregistry v0.6.0 h1:niQ+8XD//kKgArIFwDVBXsWVWbde16LPdHMyNwSC8h4=
|
||||||
|
github.com/google/go-containerregistry v0.6.0/go.mod h1:euCCtNbZ6tKqi1E72vwDj2xZcN5ttKpZLfa/wSo5iLw=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g=
|
github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g=
|
||||||
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
|||||||
24
vendor/github.com/google/go-containerregistry/internal/verify/verify.go
generated
vendored
24
vendor/github.com/google/go-containerregistry/internal/verify/verify.go
generated
vendored
@@ -17,7 +17,9 @@
|
|||||||
package verify
|
package verify
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"hash"
|
"hash"
|
||||||
"io"
|
"io"
|
||||||
@@ -81,3 +83,25 @@ func ReadCloser(r io.ReadCloser, size int64, h v1.Hash) (io.ReadCloser, error) {
|
|||||||
CloseFunc: r.Close,
|
CloseFunc: r.Close,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Descriptor verifies that the embedded Data field matches the Size and Digest
|
||||||
|
// fields of the given v1.Descriptor, returning an error if the Data field is
|
||||||
|
// missing or if it contains incorrect data.
|
||||||
|
func Descriptor(d v1.Descriptor) error {
|
||||||
|
if d.Data == nil {
|
||||||
|
return errors.New("error verifying descriptor; Data == nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
h, sz, err := v1.SHA256(bytes.NewReader(d.Data))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if h != d.Digest {
|
||||||
|
return fmt.Errorf("error verifying Digest; got %q, want %q", h, d.Digest)
|
||||||
|
}
|
||||||
|
if sz != d.Size {
|
||||||
|
return fmt.Errorf("error verifying Size; got %d, want %d", sz, d.Size)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
1
vendor/github.com/google/go-containerregistry/pkg/v1/manifest.go
generated
vendored
1
vendor/github.com/google/go-containerregistry/pkg/v1/manifest.go
generated
vendored
@@ -43,6 +43,7 @@ type Descriptor struct {
|
|||||||
MediaType types.MediaType `json:"mediaType"`
|
MediaType types.MediaType `json:"mediaType"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
Digest Hash `json:"digest"`
|
Digest Hash `json:"digest"`
|
||||||
|
Data []byte `json:"data,omitempty"`
|
||||||
URLs []string `json:"urls,omitempty"`
|
URLs []string `json:"urls,omitempty"`
|
||||||
Annotations map[string]string `json:"annotations,omitempty"`
|
Annotations map[string]string `json:"annotations,omitempty"`
|
||||||
Platform *Platform `json:"platform,omitempty"`
|
Platform *Platform `json:"platform,omitempty"`
|
||||||
|
|||||||
5
vendor/github.com/google/go-containerregistry/pkg/v1/mutate/image.go
generated
vendored
5
vendor/github.com/google/go-containerregistry/pkg/v1/mutate/image.go
generated
vendored
@@ -130,6 +130,11 @@ func (i *image) compute() error {
|
|||||||
manifest.Config.Digest = d
|
manifest.Config.Digest = d
|
||||||
manifest.Config.Size = sz
|
manifest.Config.Size = sz
|
||||||
|
|
||||||
|
// If Data was set in the base image, we need to update it in the mutated image.
|
||||||
|
if m.Config.Data != nil {
|
||||||
|
manifest.Config.Data = rcfg
|
||||||
|
}
|
||||||
|
|
||||||
// With OCI media types, this should not be set, see discussion:
|
// With OCI media types, this should not be set, see discussion:
|
||||||
// https://github.com/opencontainers/image-spec/pull/795
|
// https://github.com/opencontainers/image-spec/pull/795
|
||||||
if i.mediaType != nil {
|
if i.mediaType != nil {
|
||||||
|
|||||||
3
vendor/github.com/google/go-containerregistry/pkg/v1/mutate/index.go
generated
vendored
3
vendor/github.com/google/go-containerregistry/pkg/v1/mutate/index.go
generated
vendored
@@ -51,6 +51,9 @@ func computeDescriptor(ia IndexAddendum) (*v1.Descriptor, error) {
|
|||||||
if len(ia.Descriptor.Annotations) != 0 {
|
if len(ia.Descriptor.Annotations) != 0 {
|
||||||
desc.Annotations = ia.Descriptor.Annotations
|
desc.Annotations = ia.Descriptor.Annotations
|
||||||
}
|
}
|
||||||
|
if ia.Descriptor.Data != nil {
|
||||||
|
desc.Data = ia.Descriptor.Data
|
||||||
|
}
|
||||||
|
|
||||||
return desc, nil
|
return desc, nil
|
||||||
}
|
}
|
||||||
|
|||||||
10
vendor/github.com/google/go-containerregistry/pkg/v1/remote/catalog.go
generated
vendored
10
vendor/github.com/google/go-containerregistry/pkg/v1/remote/catalog.go
generated
vendored
@@ -88,10 +88,12 @@ func Catalog(ctx context.Context, target name.Registry, options ...Option) ([]st
|
|||||||
}
|
}
|
||||||
|
|
||||||
uri := &url.URL{
|
uri := &url.URL{
|
||||||
Scheme: target.Scheme(),
|
Scheme: target.Scheme(),
|
||||||
Host: target.RegistryStr(),
|
Host: target.RegistryStr(),
|
||||||
Path: "/v2/_catalog",
|
Path: "/v2/_catalog",
|
||||||
RawQuery: "n=10000",
|
// ECR returns an error if n > 1000:
|
||||||
|
// https://github.com/google/go-containerregistry/issues/1091
|
||||||
|
RawQuery: "n=1000",
|
||||||
}
|
}
|
||||||
|
|
||||||
client := http.Client{Transport: tr}
|
client := http.Client{Transport: tr}
|
||||||
|
|||||||
13
vendor/github.com/google/go-containerregistry/pkg/v1/remote/image.go
generated
vendored
13
vendor/github.com/google/go-containerregistry/pkg/v1/remote/image.go
generated
vendored
@@ -15,6 +15,7 @@
|
|||||||
package remote
|
package remote
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -100,6 +101,14 @@ func (r *remoteImage) RawConfigFile() ([]byte, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if m.Config.Data != nil {
|
||||||
|
if err := verify.Descriptor(m.Config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
r.config = m.Config.Data
|
||||||
|
return r.config, nil
|
||||||
|
}
|
||||||
|
|
||||||
body, err := r.fetchBlob(r.context, m.Config.Size, m.Config.Digest)
|
body, err := r.fetchBlob(r.context, m.Config.Size, m.Config.Digest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -143,6 +152,10 @@ func (rl *remoteImageLayer) Compressed() (io.ReadCloser, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if d.Data != nil {
|
||||||
|
return verify.ReadCloser(ioutil.NopCloser(bytes.NewReader(d.Data)), d.Size, d.Digest)
|
||||||
|
}
|
||||||
|
|
||||||
// We don't want to log binary layers -- this can break terminals.
|
// We don't want to log binary layers -- this can break terminals.
|
||||||
ctx := redact.NewContext(rl.ri.context, "omitting binary blobs from logs")
|
ctx := redact.NewContext(rl.ri.context, "omitting binary blobs from logs")
|
||||||
|
|
||||||
|
|||||||
18
vendor/github.com/google/go-containerregistry/pkg/v1/remote/index.go
generated
vendored
18
vendor/github.com/google/go-containerregistry/pkg/v1/remote/index.go
generated
vendored
@@ -19,6 +19,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/google/go-containerregistry/internal/verify"
|
||||||
"github.com/google/go-containerregistry/pkg/name"
|
"github.com/google/go-containerregistry/pkg/name"
|
||||||
v1 "github.com/google/go-containerregistry/pkg/v1"
|
v1 "github.com/google/go-containerregistry/pkg/v1"
|
||||||
"github.com/google/go-containerregistry/pkg/v1/partial"
|
"github.com/google/go-containerregistry/pkg/v1/partial"
|
||||||
@@ -198,9 +199,20 @@ func (r *remoteIndex) childByHash(h v1.Hash) (*Descriptor, error) {
|
|||||||
// Convert one of this index's child's v1.Descriptor into a remote.Descriptor, with the given platform option.
|
// Convert one of this index's child's v1.Descriptor into a remote.Descriptor, with the given platform option.
|
||||||
func (r *remoteIndex) childDescriptor(child v1.Descriptor, platform v1.Platform) (*Descriptor, error) {
|
func (r *remoteIndex) childDescriptor(child v1.Descriptor, platform v1.Platform) (*Descriptor, error) {
|
||||||
ref := r.Ref.Context().Digest(child.Digest.String())
|
ref := r.Ref.Context().Digest(child.Digest.String())
|
||||||
manifest, _, err := r.fetchManifest(ref, []types.MediaType{child.MediaType})
|
var (
|
||||||
if err != nil {
|
manifest []byte
|
||||||
return nil, err
|
err error
|
||||||
|
)
|
||||||
|
if child.Data != nil {
|
||||||
|
if err := verify.Descriptor(child); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
manifest = child.Data
|
||||||
|
} else {
|
||||||
|
manifest, _, err = r.fetchManifest(ref, []types.MediaType{child.MediaType})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return &Descriptor{
|
return &Descriptor{
|
||||||
fetcher: fetcher{
|
fetcher: fetcher{
|
||||||
|
|||||||
26
vendor/github.com/google/go-containerregistry/pkg/v1/remote/list.go
generated
vendored
26
vendor/github.com/google/go-containerregistry/pkg/v1/remote/list.go
generated
vendored
@@ -31,14 +31,16 @@ type tags struct {
|
|||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List wraps ListWithContext using the background context.
|
// ListWithContext calls List with the given context.
|
||||||
func List(repo name.Repository, options ...Option) ([]string, error) {
|
//
|
||||||
return ListWithContext(context.Background(), repo, options...)
|
// Deprecated: Use List and WithContext. This will be removed in a future release.
|
||||||
|
func ListWithContext(ctx context.Context, repo name.Repository, options ...Option) ([]string, error) {
|
||||||
|
return List(repo, append(options, WithContext(ctx))...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListWithContext calls /tags/list for the given repository, returning the list of tags
|
// List calls /tags/list for the given repository, returning the list of tags
|
||||||
// in the "tags" property.
|
// in the "tags" property.
|
||||||
func ListWithContext(ctx context.Context, repo name.Repository, options ...Option) ([]string, error) {
|
func List(repo name.Repository, options ...Option) ([]string, error) {
|
||||||
o, err := makeOptions(repo, options...)
|
o, err := makeOptions(repo, options...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -58,13 +60,6 @@ func ListWithContext(ctx context.Context, repo name.Repository, options ...Optio
|
|||||||
RawQuery: "n=1000",
|
RawQuery: "n=1000",
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is lazy, but I want to make sure List(..., WithContext(ctx)) works
|
|
||||||
// without calling makeOptions() twice (which can have side effects).
|
|
||||||
// This means ListWithContext(ctx, ..., WithContext(ctx2)) prefers ctx2.
|
|
||||||
if o.context != context.Background() {
|
|
||||||
ctx = o.context
|
|
||||||
}
|
|
||||||
|
|
||||||
client := http.Client{Transport: tr}
|
client := http.Client{Transport: tr}
|
||||||
tagList := []string{}
|
tagList := []string{}
|
||||||
parsed := tags{}
|
parsed := tags{}
|
||||||
@@ -72,16 +67,15 @@ func ListWithContext(ctx context.Context, repo name.Repository, options ...Optio
|
|||||||
// get responses until there is no next page
|
// get responses until there is no next page
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-o.context.Done():
|
||||||
return nil, ctx.Err()
|
return nil, o.context.Err()
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequest("GET", uri.String(), nil)
|
req, err := http.NewRequestWithContext(o.context, "GET", uri.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
req = req.WithContext(ctx)
|
|
||||||
|
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
23
vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/ping.go
generated
vendored
23
vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/ping.go
generated
vendored
@@ -108,8 +108,8 @@ func ping(ctx context.Context, reg name.Registry, t http.RoundTripper) (*pingRes
|
|||||||
}, nil
|
}, nil
|
||||||
case http.StatusUnauthorized:
|
case http.StatusUnauthorized:
|
||||||
if challenges := authchallenge.ResponseChallenges(resp); len(challenges) != 0 {
|
if challenges := authchallenge.ResponseChallenges(resp); len(challenges) != 0 {
|
||||||
// If we hit more than one, I'm not even sure what to do.
|
// If we hit more than one, let's try to find one that we know how to handle.
|
||||||
wac := challenges[0]
|
wac := pickFromMultipleChallenges(challenges)
|
||||||
return &pingResp{
|
return &pingResp{
|
||||||
challenge: challenge(wac.Scheme).Canonical(),
|
challenge: challenge(wac.Scheme).Canonical(),
|
||||||
parameters: wac.Parameters,
|
parameters: wac.Parameters,
|
||||||
@@ -127,3 +127,22 @@ func ping(ctx context.Context, reg name.Registry, t http.RoundTripper) (*pingRes
|
|||||||
}
|
}
|
||||||
return nil, errors.New(strings.Join(errs, "; "))
|
return nil, errors.New(strings.Join(errs, "; "))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func pickFromMultipleChallenges(challenges []authchallenge.Challenge) authchallenge.Challenge {
|
||||||
|
|
||||||
|
// It might happen there are multiple www-authenticate headers, e.g. `Negotiate` and `Basic`.
|
||||||
|
// Picking simply the first one could result eventually in `unrecognized challenge` error,
|
||||||
|
// that's why we're looping through the challenges in search for one that can be handled.
|
||||||
|
allowedSchemes := []string{"basic", "bearer"}
|
||||||
|
|
||||||
|
for _, wac := range challenges {
|
||||||
|
currentScheme := strings.ToLower(wac.Scheme)
|
||||||
|
for _, allowed := range allowedSchemes {
|
||||||
|
if allowed == currentScheme {
|
||||||
|
return wac
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return challenges[0]
|
||||||
|
}
|
||||||
|
|||||||
5
vendor/github.com/google/go-containerregistry/pkg/v1/zz_deepcopy_generated.go
generated
vendored
5
vendor/github.com/google/go-containerregistry/pkg/v1/zz_deepcopy_generated.go
generated
vendored
@@ -115,6 +115,11 @@ func (in *ConfigFile) DeepCopy() *ConfigFile {
|
|||||||
func (in *Descriptor) DeepCopyInto(out *Descriptor) {
|
func (in *Descriptor) DeepCopyInto(out *Descriptor) {
|
||||||
*out = *in
|
*out = *in
|
||||||
out.Digest = in.Digest
|
out.Digest = in.Digest
|
||||||
|
if in.Data != nil {
|
||||||
|
in, out := &in.Data, &out.Data
|
||||||
|
*out = make([]byte, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
if in.URLs != nil {
|
if in.URLs != nil {
|
||||||
in, out := &in.URLs, &out.URLs
|
in, out := &in.URLs, &out.URLs
|
||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
|
|||||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -110,7 +110,7 @@ github.com/google/go-cmp/cmp/internal/diff
|
|||||||
github.com/google/go-cmp/cmp/internal/flags
|
github.com/google/go-cmp/cmp/internal/flags
|
||||||
github.com/google/go-cmp/cmp/internal/function
|
github.com/google/go-cmp/cmp/internal/function
|
||||||
github.com/google/go-cmp/cmp/internal/value
|
github.com/google/go-cmp/cmp/internal/value
|
||||||
# github.com/google/go-containerregistry v0.5.2-0.20210720200529-2f6fbf77f249
|
# github.com/google/go-containerregistry v0.6.0
|
||||||
## explicit
|
## explicit
|
||||||
github.com/google/go-containerregistry/cmd/crane/cmd
|
github.com/google/go-containerregistry/cmd/crane/cmd
|
||||||
github.com/google/go-containerregistry/internal/and
|
github.com/google/go-containerregistry/internal/and
|
||||||
|
|||||||
Reference in New Issue
Block a user