From 3864408e2794626defdbd20e06e302446eb94906 Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Fri, 29 Jul 2022 16:25:36 -0700 Subject: [PATCH] Fix keyful handling in tester. Signed-off-by: Ville Aikas --- cmd/tester/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/tester/main.go b/cmd/tester/main.go index ee7442425..79877d986 100644 --- a/cmd/tester/main.go +++ b/cmd/tester/main.go @@ -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)