diff --git a/image/fixtures/oci1-to-schema2.json b/image/fixtures/oci1-to-schema2.json index 8861521ec2..e0d72c09b9 100644 --- a/image/fixtures/oci1-to-schema2.json +++ b/image/fixtures/oci1-to-schema2.json @@ -20,7 +20,8 @@ { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 11739507, - "digest": "sha256:8f5dc8a4b12c307ac84de90cdd9a7f3915d1be04c9388868ca118831099c67a9" + "digest": "sha256:8f5dc8a4b12c307ac84de90cdd9a7f3915d1be04c9388868ca118831099c67a9", + "urls": ["https://layer.url"] }, { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", diff --git a/image/fixtures/oci1.json b/image/fixtures/oci1.json index bb12d73630..dbac4a9551 100644 --- a/image/fixtures/oci1.json +++ b/image/fixtures/oci1.json @@ -22,7 +22,8 @@ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 11739507, - "digest": "sha256:8f5dc8a4b12c307ac84de90cdd9a7f3915d1be04c9388868ca118831099c67a9" + "digest": "sha256:8f5dc8a4b12c307ac84de90cdd9a7f3915d1be04c9388868ca118831099c67a9", + "urls": ["https://layer.url"] }, { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", diff --git a/image/oci.go b/image/oci.go index 7ea5d2bb1b..5f7c072843 100644 --- a/image/oci.go +++ b/image/oci.go @@ -109,7 +109,7 @@ func (m *manifestOCI1) OCIConfig() (*imgspecv1.Image, error) { func (m *manifestOCI1) LayerInfos() []types.BlobInfo { blobs := []types.BlobInfo{} for _, layer := range m.LayersDescriptors { - blobs = append(blobs, types.BlobInfo{Digest: layer.Digest, Size: layer.Size, Annotations: layer.Annotations}) + blobs = append(blobs, types.BlobInfo{Digest: layer.Digest, Size: layer.Size, Annotations: layer.Annotations, URLs: layer.URLs}) } return blobs } @@ -160,6 +160,7 @@ func (m *manifestOCI1) UpdatedImage(options types.ManifestUpdateOptions) (types. copy.LayersDescriptors[i].Digest = info.Digest copy.LayersDescriptors[i].Size = info.Size copy.LayersDescriptors[i].Annotations = info.Annotations + copy.LayersDescriptors[i].URLs = info.URLs } } // Ignore options.EmbeddedDockerReference: it may be set when converting from schema1, but we really don't care. diff --git a/image/oci_test.go b/image/oci_test.go index 02176f4a90..972f100f37 100644 --- a/image/oci_test.go +++ b/image/oci_test.go @@ -53,6 +53,9 @@ func manifestOCI1FromComponentsLikeFixture(configBlob []byte) genericManifest { MediaType: imgspecv1.MediaTypeImageLayerGzip, Digest: "sha256:8f5dc8a4b12c307ac84de90cdd9a7f3915d1be04c9388868ca118831099c67a9", Size: 11739507, + URLs: []string{ + "https://layer.url", + }, }}, { descriptor: descriptor{ @@ -207,6 +210,9 @@ func TestManifestOCI1LayerInfo(t *testing.T) { { Digest: "sha256:8f5dc8a4b12c307ac84de90cdd9a7f3915d1be04c9388868ca118831099c67a9", Size: 11739507, + URLs: []string{ + "https://layer.url", + }, }, { Digest: "sha256:bbd6b22eb11afce63cc76f6bc41042d99f10d6024c96b655dafba930b8d25909", diff --git a/oci/archive/oci_dest.go b/oci/archive/oci_dest.go index b2c4bb6316..ba5a9e8cc1 100644 --- a/oci/archive/oci_dest.go +++ b/oci/archive/oci_dest.go @@ -106,11 +106,8 @@ func (d *ociArchiveImageDestination) Commit() error { src := d.tempDirRef.tempDirectory // path to save tarred up file dst := d.ref.resolvedFile - if err := tarDirectory(src, dst); err != nil { - return err - } - return nil + return tarDirectory(src, dst) } // tar converts the directory at src and saves it to dst diff --git a/signature/signature.go b/signature/signature.go index f6219bec87..41f13f72fd 100644 --- a/signature/signature.go +++ b/signature/signature.go @@ -180,13 +180,9 @@ func (s *untrustedSignature) strictUnmarshalJSON(data []byte) error { } s.UntrustedDockerManifestDigest = digest.Digest(digestString) - if err := paranoidUnmarshalJSONObjectExactFields(identity, map[string]interface{}{ + return paranoidUnmarshalJSONObjectExactFields(identity, map[string]interface{}{ "docker-reference": &s.UntrustedDockerReference, - }); err != nil { - return err - } - - return nil + }) } // Sign formats the signature and returns a blob signed using mech and keyIdentity