Skip to content

Commit 91f71a9

Browse files
dependabot[bot]ci-robot
authored andcommitted
Bump oras.land/oras-go/v2 from 2.5.0 to 2.6.0 (#1668)
Bumps [oras.land/oras-go/v2](https://github.com/oras-project/oras-go) from 2.5.0 to 2.6.0. - [Release notes](https://github.com/oras-project/oras-go/releases) - [Commits](oras-project/oras-go@v2.5.0...v2.6.0) --- updated-dependencies: - dependency-name: oras.land/oras-go/v2 dependency-version: 2.6.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Upstream-repository: operator-registry Upstream-commit: 5288e322967e5c51b10652f395132398dd73c391
1 parent daea714 commit 91f71a9

File tree

17 files changed

+112
-60
lines changed

17 files changed

+112
-60
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ require (
248248
k8s.io/kms v0.32.3 // indirect
249249
k8s.io/kube-aggregator v0.32.3 // indirect
250250
k8s.io/kubectl v0.32.0 // indirect
251-
oras.land/oras-go/v2 v2.5.0 // indirect
251+
oras.land/oras-go/v2 v2.6.0 // indirect
252252
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 // indirect
253253
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
254254
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3281,8 +3281,8 @@ modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
32813281
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
32823282
modernc.org/z v1.5.1/go.mod h1:eWFB510QWW5Th9YGZT81s+LwvaAs3Q2yr4sP0rmLkv8=
32833283
modernc.org/z v1.7.0/go.mod h1:hVdgNMh8ggTuRG1rGU8x+xGRFfiQUIAw0ZqlPy8+HyQ=
3284-
oras.land/oras-go/v2 v2.5.0 h1:o8Me9kLY74Vp5uw07QXPiitjsw7qNXi8Twd+19Zf02c=
3285-
oras.land/oras-go/v2 v2.5.0/go.mod h1:z4eisnLP530vwIOUOJeBIj0aGI0L1C3d53atvCBqZHg=
3284+
oras.land/oras-go/v2 v2.6.0 h1:X4ELRsiGkrbeox69+9tzTu492FMUu7zJQW6eJU+I2oc=
3285+
oras.land/oras-go/v2 v2.6.0/go.mod h1:magiQDfG6H1O9APp+rOsvCPcW1GD2MM7vgnKY0Y+u1o=
32863286
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
32873287
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
32883288
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=

staging/operator-registry/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ require (
5252
k8s.io/apimachinery v0.32.3
5353
k8s.io/client-go v0.32.3
5454
k8s.io/kubectl v0.32.0
55-
oras.land/oras-go/v2 v2.5.0
55+
oras.land/oras-go/v2 v2.6.0
5656
sigs.k8s.io/controller-runtime v0.20.4
5757
sigs.k8s.io/kind v0.27.0
5858
sigs.k8s.io/yaml v1.4.0

staging/operator-registry/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,8 +730,8 @@ k8s.io/kubectl v0.32.0 h1:rpxl+ng9qeG79YA4Em9tLSfX0G8W0vfaiPVrc/WR7Xw=
730730
k8s.io/kubectl v0.32.0/go.mod h1:qIjSX+QgPQUgdy8ps6eKsYNF+YmFOAO3WygfucIqFiE=
731731
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro=
732732
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
733-
oras.land/oras-go/v2 v2.5.0 h1:o8Me9kLY74Vp5uw07QXPiitjsw7qNXi8Twd+19Zf02c=
734-
oras.land/oras-go/v2 v2.5.0/go.mod h1:z4eisnLP530vwIOUOJeBIj0aGI0L1C3d53atvCBqZHg=
733+
oras.land/oras-go/v2 v2.6.0 h1:X4ELRsiGkrbeox69+9tzTu492FMUu7zJQW6eJU+I2oc=
734+
oras.land/oras-go/v2 v2.6.0/go.mod h1:magiQDfG6H1O9APp+rOsvCPcW1GD2MM7vgnKY0Y+u1o=
735735
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo=
736736
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
737737
sigs.k8s.io/controller-runtime v0.20.4 h1:X3c+Odnxz+iPTRobG4tp092+CvBU9UK0t/bRf+n0DGU=

vendor/modules.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2238,8 +2238,8 @@ k8s.io/utils/path
22382238
k8s.io/utils/pointer
22392239
k8s.io/utils/ptr
22402240
k8s.io/utils/trace
2241-
# oras.land/oras-go/v2 v2.5.0
2242-
## explicit; go 1.21
2241+
# oras.land/oras-go/v2 v2.6.0
2242+
## explicit; go 1.23.0
22432243
oras.land/oras-go/v2/content
22442244
oras.land/oras-go/v2/content/oci
22452245
oras.land/oras-go/v2/errdef

vendor/oras.land/oras-go/v2/content/oci/oci.go

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ limitations under the License.
1414
*/
1515

1616
// Package oci provides access to an OCI content store.
17-
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/image-layout.md
17+
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.1/image-layout.md
1818
package oci
1919

2020
import (
@@ -44,7 +44,7 @@ import (
4444

4545
// Store implements `oras.Target`, and represents a content store
4646
// based on file system with the OCI-Image layout.
47-
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/image-layout.md
47+
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.1/image-layout.md
4848
type Store struct {
4949
// AutoSaveIndex controls if the OCI store will automatically save the index
5050
// file when needed.
@@ -157,10 +157,11 @@ func (s *Store) Exists(ctx context.Context, target ocispec.Descriptor) (bool, er
157157

158158
// Delete deletes the content matching the descriptor from the store. Delete may
159159
// fail on certain systems (i.e. NTFS), if there is a process (i.e. an unclosed
160-
// Reader) using target. If s.AutoGC is set to true, Delete will recursively
161-
// remove the dangling blobs caused by the current delete. If s.AutoDeleteReferrers
162-
// is set to true, Delete will recursively remove the referrers of the manifests
163-
// being deleted.
160+
// Reader) using target.
161+
// - If s.AutoGC is set to true, Delete will recursively
162+
// remove the dangling blobs caused by the current delete.
163+
// - If s.AutoDeleteReferrers is set to true, Delete will recursively remove
164+
// the referrers of the manifests being deleted.
164165
func (s *Store) Delete(ctx context.Context, target ocispec.Descriptor) error {
165166
s.sync.Lock()
166167
defer s.sync.Unlock()
@@ -220,9 +221,18 @@ func (s *Store) delete(ctx context.Context, target ocispec.Descriptor) ([]ocispe
220221
return danglings, nil
221222
}
222223

223-
// Tag tags a descriptor with a reference string.
224-
// reference should be a valid tag (e.g. "latest").
225-
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/image-layout.md#indexjson-file
224+
// Tag associates a reference string (e.g. "latest") with the descriptor.
225+
// The reference string is recorded in the "org.opencontainers.image.ref.name"
226+
// annotation of the descriptor. When saved, the updated descriptor is persisted
227+
// in the `index.json` file.
228+
//
229+
// - If the same reference string is tagged multiple times on different
230+
// descriptors, the descriptor from the last call will be stored.
231+
// - If the same descriptor is tagged multiple times with different reference
232+
// strings, multiple copies of the descriptor with different reference tags
233+
// will be stored in the `index.json` file.
234+
//
235+
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.1/image-layout.md#indexjson-file
226236
func (s *Store) Tag(ctx context.Context, desc ocispec.Descriptor, reference string) error {
227237
s.sync.RLock()
228238
defer s.sync.RUnlock()
@@ -260,11 +270,11 @@ func (s *Store) tag(ctx context.Context, desc ocispec.Descriptor, reference stri
260270
return nil
261271
}
262272

263-
// Resolve resolves a reference to a descriptor. If the reference to be resolved
264-
// is a tag, the returned descriptor will be a full descriptor declared by
265-
// github.com/opencontainers/image-spec/specs-go/v1. If the reference is a
266-
// digest the returned descriptor will be a plain descriptor (containing only
267-
// the digest, media type and size).
273+
// Resolve resolves a reference to a descriptor.
274+
// - If the reference to be resolved is a tag, the returned descriptor will be
275+
// a full descriptor declared by github.com/opencontainers/image-spec/specs-go/v1.
276+
// - If the reference is a digest, the returned descriptor will be a
277+
// plain descriptor (containing only the digest, media type and size).
268278
func (s *Store) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error) {
269279
s.sync.RLock()
270280
defer s.sync.RUnlock()
@@ -290,6 +300,13 @@ func (s *Store) Resolve(ctx context.Context, reference string) (ocispec.Descript
290300
return desc, nil
291301
}
292302

303+
// Untag disassociates a reference string from its descriptor.
304+
// When saved, the descriptor entry cotanining the reference in the
305+
// "org.opencontainers.image.ref.name" annotation is removed from the
306+
// `index.json` file.
307+
// The actual content identified by the descriptor is NOT deleted.
308+
//
309+
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.1/image-layout.md#indexjson-file
293310
func (s *Store) Untag(ctx context.Context, reference string) error {
294311
if reference == "" {
295312
return errdef.ErrMissingReference
@@ -379,6 +396,7 @@ func (s *Store) loadIndexFile(ctx context.Context) error {
379396
Versioned: specs.Versioned{
380397
SchemaVersion: 2, // historical value
381398
},
399+
MediaType: ocispec.MediaTypeImageIndex,
382400
Manifests: []ocispec.Descriptor{},
383401
}
384402
return s.writeIndexFile()

vendor/oras.land/oras-go/v2/content/oci/readonlyoci.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636

3737
// ReadOnlyStore implements `oras.ReadonlyTarget`, and represents a read-only
3838
// content store based on file system with the OCI-Image layout.
39-
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/image-layout.md
39+
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.1/image-layout.md
4040
type ReadOnlyStore struct {
4141
fsys fs.FS
4242
storage content.ReadOnlyStorage
@@ -83,11 +83,11 @@ func (s *ReadOnlyStore) Exists(ctx context.Context, target ocispec.Descriptor) (
8383
return s.storage.Exists(ctx, target)
8484
}
8585

86-
// Resolve resolves a reference to a descriptor. If the reference to be resolved
87-
// is a tag, the returned descriptor will be a full descriptor declared by
88-
// github.com/opencontainers/image-spec/specs-go/v1. If the reference is a
89-
// digest the returned descriptor will be a plain descriptor (containing only
90-
// the digest, media type and size).
86+
// Resolve resolves a reference to a descriptor.
87+
// - If the reference to be resolved is a tag, the returned descriptor will be
88+
// a full descriptor declared by github.com/opencontainers/image-spec/specs-go/v1.
89+
// - If the reference is a digest, the returned descriptor will be a
90+
// plain descriptor (containing only the digest, media type and size).
9191
func (s *ReadOnlyStore) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error) {
9292
if reference == "" {
9393
return ocispec.Descriptor{}, errdef.ErrMissingReference

vendor/oras.land/oras-go/v2/content/oci/readonlystorage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131

3232
// ReadOnlyStorage is a read-only CAS based on file system with the OCI-Image
3333
// layout.
34-
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/image-layout.md
34+
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.1/image-layout.md
3535
type ReadOnlyStorage struct {
3636
fsys fs.FS
3737
}

vendor/oras.land/oras-go/v2/content/oci/storage.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var bufPool = sync.Pool{
4343
}
4444

4545
// Storage is a CAS based on file system with the OCI-Image layout.
46-
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/image-layout.md
46+
// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.1/image-layout.md
4747
type Storage struct {
4848
*ReadOnlyStorage
4949
// root is the root directory of the OCI layout.
@@ -141,13 +141,16 @@ func (s *Storage) ingest(expected ocispec.Descriptor, content io.Reader) (path s
141141

142142
path = fp.Name()
143143
defer func() {
144-
// remove the temp file in case of error.
145-
// this executes after the file is closed.
144+
// close the temp file and check close error
145+
if err := fp.Close(); err != nil && ingestErr == nil {
146+
ingestErr = fmt.Errorf("failed to close ingest file: %w", err)
147+
}
148+
149+
// remove the temp file in case of error
146150
if ingestErr != nil {
147151
os.Remove(path)
148152
}
149153
}()
150-
defer fp.Close()
151154

152155
buf := bufPool.Get().(*[]byte)
153156
defer bufPool.Put(buf)

vendor/oras.land/oras-go/v2/content/reader.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ func (vr *VerifyReader) Verify() error {
9999

100100
// NewVerifyReader wraps r for reading content with verification against desc.
101101
func NewVerifyReader(r io.Reader, desc ocispec.Descriptor) *VerifyReader {
102+
if err := desc.Digest.Validate(); err != nil {
103+
return &VerifyReader{
104+
err: fmt.Errorf("failed to validate %s: %w", desc.Digest, err),
105+
}
106+
}
102107
verifier := desc.Digest.Verifier()
103108
lr := &io.LimitedReader{
104109
R: io.TeeReader(r, verifier),

0 commit comments

Comments
 (0)