Skip to content

Commit 709b72a

Browse files
committed
attestations: replace intoto media type with vendored const
We were using a mixture of own custom const and the vendored const. For consistency, we should use only the vendored const everywhere. Signed-off-by: Justin Chadwell <[email protected]>
1 parent 81d19ad commit 709b72a

File tree

5 files changed

+6
-9
lines changed

5 files changed

+6
-9
lines changed

exporter/containerimage/writer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ func (ic *ImageWriter) commitAttestationsManifest(ctx context.Context, opts *Ima
437437
}
438438
digest := digest.FromBytes(data)
439439
desc := ocispecs.Descriptor{
440-
MediaType: attestationTypes.MediaTypeDockerSchema2AttestationType,
440+
MediaType: intoto.PayloadType,
441441
Digest: digest,
442442
Size: int64(len(data)),
443443
Annotations: map[string]string{

solver/llbsolver/solver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"sync"
1010
"time"
1111

12+
intoto "github.com/in-toto/in-toto-golang/in_toto"
1213
slsa02 "github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v0.2"
1314
controlapi "github.com/moby/buildkit/api/services/control"
1415
"github.com/moby/buildkit/cache"
@@ -26,7 +27,6 @@ import (
2627
"github.com/moby/buildkit/solver/llbsolver/provenance"
2728
"github.com/moby/buildkit/solver/result"
2829
spb "github.com/moby/buildkit/sourcepolicy/pb"
29-
"github.com/moby/buildkit/util/attestation"
3030
"github.com/moby/buildkit/util/bklog"
3131
"github.com/moby/buildkit/util/compression"
3232
"github.com/moby/buildkit/util/entitlements"
@@ -210,7 +210,7 @@ func (s *Solver) recordBuildHistory(ctx context.Context, id string, req frontend
210210
if err != nil {
211211
return nil, nil, err
212212
}
213-
w, err := s.history.OpenBlobWriter(ctx, attestation.MediaTypeDockerSchema2AttestationType)
213+
w, err := s.history.OpenBlobWriter(ctx, intoto.PayloadType)
214214
if err != nil {
215215
return nil, nil, err
216216
}

util/attestation/types.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package attestation
22

33
const (
4-
MediaTypeDockerSchema2AttestationType = "application/vnd.in-toto+json"
5-
64
DockerAnnotationReferenceType = "vnd.docker.reference.type"
75
DockerAnnotationReferenceDigest = "vnd.docker.reference.digest"
86
DockerAnnotationReferenceDescription = "vnd.docker.reference.description"

util/imageutil/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/containerd/containerd/reference"
1414
"github.com/containerd/containerd/remotes"
1515
"github.com/containerd/containerd/remotes/docker"
16-
"github.com/moby/buildkit/util/attestation"
16+
intoto "github.com/in-toto/in-toto-golang/in_toto"
1717
"github.com/moby/buildkit/util/contentutil"
1818
"github.com/moby/buildkit/util/leaseutil"
1919
"github.com/moby/buildkit/util/resolver/limited"
@@ -174,7 +174,7 @@ func childrenConfigHandler(provider content.Provider, platform platforms.MatchCo
174174
descs = append(descs, index.Manifests...)
175175
}
176176
case images.MediaTypeDockerSchema2Config, ocispecs.MediaTypeImageConfig, docker.LegacyConfigMediaType,
177-
attestation.MediaTypeDockerSchema2AttestationType:
177+
intoto.PayloadType:
178178
// childless data types.
179179
return nil, nil
180180
default:

util/push/push.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/containerd/containerd/remotes/docker"
1616
"github.com/docker/distribution/reference"
1717
"github.com/moby/buildkit/session"
18-
"github.com/moby/buildkit/util/attestation"
1918
"github.com/moby/buildkit/util/bklog"
2019
"github.com/moby/buildkit/util/flightcontrol"
2120
"github.com/moby/buildkit/util/imageutil"
@@ -250,7 +249,7 @@ func childrenHandler(provider content.Provider) images.HandlerFunc {
250249
case images.MediaTypeDockerSchema2Layer, images.MediaTypeDockerSchema2LayerGzip,
251250
images.MediaTypeDockerSchema2Config, ocispecs.MediaTypeImageConfig,
252251
ocispecs.MediaTypeImageLayer, ocispecs.MediaTypeImageLayerGzip,
253-
attestation.MediaTypeDockerSchema2AttestationType:
252+
intoto.PayloadType:
254253
// childless data types.
255254
return nil, nil
256255
default:

0 commit comments

Comments
 (0)