Skip to content

Commit 43f1d3c

Browse files
alacukupoiana
authored andcommitted
fix(pusher): correctly report artifact type
Signed-off-by: Aldo Lacuku <[email protected]>
1 parent 5d2bfa7 commit 43f1d3c

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

cmd/registry/push/push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (o *pushOptions) runPush(ctx context.Context, args []string) error {
203203
return err
204204
}
205205

206-
logger.Info("Artifact pushed", logger.Args("name", args[0], "type", res.Type, "digest", res.Digest))
206+
logger.Info("Artifact pushed", logger.Args("name", args[0], "type", res.Type, "digest", res.RootDigest))
207207

208208
return nil
209209
}

pkg/oci/pusher/pusher.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ func (p *Pusher) Push(ctx context.Context, artifactType oci.ArtifactType,
203203
}
204204

205205
return &oci.RegistryResult{
206-
Digest: string(rootDesc.Digest),
206+
RootDigest: string(rootDesc.Digest),
207+
Type: artifactType,
207208
}, nil
208209
}
209210

pkg/oci/pusher/pusher_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ var _ = Describe("Pusher", func() {
138138
Expect(err).ToNot(HaveOccurred())
139139
// Being the artifact of type plugin we expect that the retrieved descriptor is of type image index.
140140
Expect(d.MediaType).To(Equal(v1.MediaTypeImageIndex))
141-
Expect(d.Digest.String()).To(Equal(result.Digest))
141+
Expect(d.Digest.String()).To(Equal(result.RootDigest))
142142
Expect(index.Manifests).To(HaveLen(1))
143143
Expect(fmt.Sprintf("%s/%s", index.Manifests[0].Platform.OS, index.Manifests[0].Platform.Architecture)).To(Equal(testPluginPlatform1))
144144
// Check layer and config media types.
@@ -188,7 +188,7 @@ var _ = Describe("Pusher", func() {
188188
Expect(err).ToNot(HaveOccurred())
189189
// Being the artifact of type plugin we expect that the retrieved descriptor is of type image index.
190190
Expect(d.MediaType).To(Equal(v1.MediaTypeImageIndex))
191-
Expect(d.Digest.String()).To(Equal(result.Digest))
191+
Expect(d.Digest.String()).To(Equal(result.RootDigest))
192192
Expect(index.Manifests).To(HaveLen(3))
193193
Expect(fmt.Sprintf("%s/%s", index.Manifests[0].Platform.OS, index.Manifests[0].Platform.Architecture)).To(Equal(testPluginPlatform1))
194194
Expect(fmt.Sprintf("%s/%s", index.Manifests[1].Platform.OS, index.Manifests[1].Platform.Architecture)).To(Equal(testPluginPlatform2))
@@ -225,7 +225,7 @@ var _ = Describe("Pusher", func() {
225225
Expect(err).ToNot(HaveOccurred())
226226
// Being the artifact of type rulesfile we expect that the retrieved descriptor is of type manifest.
227227
Expect(d.MediaType).To(Equal(v1.MediaTypeImageManifest))
228-
Expect(d.Digest.String()).To(Equal(result.Digest))
228+
Expect(d.Digest.String()).To(Equal(result.RootDigest))
229229
// It must have only one layer since no config layer is configured.
230230
Expect(manifest.Layers).To(HaveLen(1))
231231
// It must have the rulesfile's layer mediatype.
@@ -276,7 +276,7 @@ var _ = Describe("Pusher", func() {
276276
Expect(err).ToNot(HaveOccurred())
277277
// Being the artifact of type rulesfile we expect that the retrieved descriptor is of type manifest.
278278
Expect(d.MediaType).To(Equal(v1.MediaTypeImageManifest))
279-
Expect(d.Digest.String()).To(Equal(result.Digest))
279+
Expect(d.Digest.String()).To(Equal(result.RootDigest))
280280
// It must have only one layer since no config layer is configured.
281281
Expect(manifest.Layers).To(HaveLen(1))
282282
// It must have the rulesfile's layer mediatype.
@@ -348,7 +348,7 @@ var _ = Describe("Pusher", func() {
348348
// Being the artifact of type asset we expect that the retrieved descriptor is of type manifest.
349349
Expect(d.MediaType).To(Equal(v1.MediaTypeImageManifest))
350350
// Checking the digest is correct.
351-
Expect(d.Digest.String()).To(Equal(result.Digest))
351+
Expect(d.Digest.String()).To(Equal(result.RootDigest))
352352
// It must have only one layer since no config layer is configured.
353353
Expect(manifest.Layers).To(HaveLen(1))
354354
// The layer has to be of type asset.

0 commit comments

Comments
 (0)