From 4cf4aa383120bab9df5c96d4ad905b4c16cb93a3 Mon Sep 17 00:00:00 2001 From: thesayyn Date: Thu, 22 Feb 2024 13:35:57 -0800 Subject: [PATCH] revert --- pkg/v1/layout/layer.go | 2 +- pkg/v1/layout/puller.go | 2 +- pkg/v1/layout/pusher.go | 4 ++-- pkg/v1/partial/artifact.go | 2 +- pkg/v1/remote/artifact.go | 23 ----------------------- pkg/v1/remote/descriptor.go | 4 ---- pkg/v1/remote/puller.go | 10 +--------- 7 files changed, 6 insertions(+), 41 deletions(-) diff --git a/pkg/v1/layout/layer.go b/pkg/v1/layout/layer.go index 1a58a6acc..9870f60f5 100644 --- a/pkg/v1/layout/layer.go +++ b/pkg/v1/layout/layer.go @@ -1,4 +1,4 @@ -// Copyright 2019 The original author or authors +// Copyright 2019 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/v1/layout/puller.go b/pkg/v1/layout/puller.go index e96186872..3fed1e405 100644 --- a/pkg/v1/layout/puller.go +++ b/pkg/v1/layout/puller.go @@ -1,4 +1,4 @@ -// Copyright 2019 The original author or authors +// Copyright 2019 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/v1/layout/pusher.go b/pkg/v1/layout/pusher.go index ef5681c2e..7ca53a18a 100644 --- a/pkg/v1/layout/pusher.go +++ b/pkg/v1/layout/pusher.go @@ -1,10 +1,10 @@ -// Copyright 2019 The original author or authors +// Copyright 2019 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/v1/partial/artifact.go b/pkg/v1/partial/artifact.go index 229ea3385..774496b0c 100644 --- a/pkg/v1/partial/artifact.go +++ b/pkg/v1/partial/artifact.go @@ -1,4 +1,4 @@ -// Copyright 2019 The original author or authors +// Copyright 2019 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/v1/remote/artifact.go b/pkg/v1/remote/artifact.go index 83a554651..7aa06c01a 100644 --- a/pkg/v1/remote/artifact.go +++ b/pkg/v1/remote/artifact.go @@ -16,33 +16,10 @@ package remote import ( "github.com/google/go-containerregistry/pkg/name" - v1 "github.com/google/go-containerregistry/pkg/v1" "github.com/google/go-containerregistry/pkg/v1/partial" "github.com/google/go-containerregistry/pkg/v1/types" ) -type descriptorArtifact struct { - desc Descriptor -} - -func (d *descriptorArtifact) Digest() (v1.Hash, error) { - return d.desc.Digest, nil -} - -func (d *descriptorArtifact) MediaType() (types.MediaType, error) { - return d.desc.MediaType, nil -} - -func (d *descriptorArtifact) RawManifest() ([]byte, error) { - return d.desc.RawManifest() -} - -func (d *descriptorArtifact) Size() (int64, error) { - return d.desc.Size, nil -} - -var _ partial.Artifact = (*descriptorArtifact)(nil) - // Get returns a partial.Artifact for the given reference. // // See Head if you don't need the response body. diff --git a/pkg/v1/remote/descriptor.go b/pkg/v1/remote/descriptor.go index 35f518259..a96af5108 100644 --- a/pkg/v1/remote/descriptor.go +++ b/pkg/v1/remote/descriptor.go @@ -55,10 +55,6 @@ type Descriptor struct { platform v1.Platform } -func (d *Descriptor) ToArtifact() partial.Artifact { - return &descriptorArtifact{desc: *d} -} - func (d *Descriptor) toDesc() v1.Descriptor { return d.Descriptor } diff --git a/pkg/v1/remote/puller.go b/pkg/v1/remote/puller.go index 878fba1bb..2489c443f 100644 --- a/pkg/v1/remote/puller.go +++ b/pkg/v1/remote/puller.go @@ -140,15 +140,7 @@ func (p *puller) artifact(ctx context.Context, ref name.Reference, acceptable [] if desc.MediaType.IsImage() { return desc.Image() } else if desc.MediaType.IsIndex() { - idx, err := desc.ImageIndex() - if err != nil { - return nil, err - } - fmt.Println(platform.String()) - if platform.String() != "" { - return idx, nil - } - return idx, nil + return desc.ImageIndex() } else if desc.MediaType.IsSchema1() { return desc.Schema1() }