Skip to content

Commit

Permalink
Fix keyful handling in tester.
Browse files Browse the repository at this point in the history
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
  • Loading branch information
vaikas committed Jul 29, 2022
1 parent 21e02d9 commit 3864408
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/tester/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ func main() {
log.Fatalf("CIP is invalid: %s", validateErrs.Error())
}
cip := webhookcip.ConvertClusterImagePolicyV1alpha1ToWebhook(&v1alpha1cip)

// We have to marshal/unmarshal the CIP since that handles converting
// inlined Data into PublicKey objects that validator uses.
webhookCip, err := json.Marshal(cip)
if err != nil {
log.Fatalf("Failed to marshal the webhook cip: %s", err)
}
if err := json.Unmarshal(webhookCip, &cip); err != nil {
log.Fatalf("Failed to unmarshal the webhook CIP: %s", err)
}
ref, err := name.ParseReference(*image)
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit 3864408

Please # to comment.