Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Commit 39244cb

Browse files
committed
Do not exit on warnings on CIP.
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
1 parent dde7787 commit 39244cb

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

cmd/tester/main.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,14 @@ func main() {
9494

9595
validateErrs := v1alpha1cip.Validate(ctx)
9696
if validateErrs != nil {
97-
log.Fatalf("CIP is invalid: %s", validateErrs.Error())
97+
// CIP validation can return Warnings so let's just go through them
98+
// and only exit if there are Errors.
99+
if warnFE := validateErrs.Filter(apis.WarningLevel); warnFE != nil {
100+
log.Printf("CIP has warnings:\n%s\n", warnFE.Error())
101+
}
102+
if errorFE := validateErrs.Filter(apis.ErrorLevel); errorFE != nil {
103+
log.Fatalf("CIP is invalid: %s", errorFE.Error())
104+
}
98105
}
99106
cip := webhookcip.ConvertClusterImagePolicyV1alpha1ToWebhook(&v1alpha1cip)
100107

0 commit comments

Comments
 (0)