Skip to content

Commit

Permalink
push the config blob
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Dolitsky <[email protected]>
  • Loading branch information
jdolitsky committed Feb 13, 2023
1 parent 2ce0564 commit e899a84
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pkg/oci/remote/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/google/go-containerregistry/pkg/name"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/google/go-containerregistry/pkg/v1/static"
"github.com/google/go-containerregistry/pkg/v1/types"
ociexperimental "github.com/sigstore/cosign/v2/internal/pkg/oci/remote"
"github.com/sigstore/cosign/v2/pkg/oci"
Expand Down Expand Up @@ -163,6 +164,20 @@ func WriteSignaturesExperimentalOCI(d name.Digest, se oci.SignedEntity, opts ...
}
}

// Write the config
configBytes, err := sigs.RawConfigFile()
if err != nil {
return err
}
var configDesc v1.Descriptor
if err := json.Unmarshal(configBytes, &configDesc); err != nil {
return err
}
configLayer := static.NewLayer(configBytes, configDesc.MediaType)
if err := remote.WriteLayer(d.Repository, configLayer, o.ROpt...); err != nil {
return err
}

// Write the manifest containing a subject
b, err := sigs.RawManifest()
if err != nil {
Expand All @@ -173,8 +188,6 @@ func WriteSignaturesExperimentalOCI(d name.Digest, se oci.SignedEntity, opts ...
return err
}

// TODO: write the config blob

artifactType := ociexperimental.ArtifactType("sig")
m.Config.MediaType = types.MediaType(artifactType)
m.Subject = desc
Expand Down

0 comments on commit e899a84

Please sign in to comment.