From 3585ee810c499c31e44b0bd8c02713f232c8090e Mon Sep 17 00:00:00 2001 From: Sylwester Piskozub Date: Wed, 18 Jun 2025 09:28:27 +0200 Subject: [PATCH] feat(attestation): allow arbitrary annotations at runtime (#1976) Signed-off-by: Sylwester Piskozub --- app/cli/internal/action/attestation_push.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/cli/internal/action/attestation_push.go b/app/cli/internal/action/attestation_push.go index 9a6cdf1dd..287a93261 100644 --- a/app/cli/internal/action/attestation_push.go +++ b/app/cli/internal/action/attestation_push.go @@ -119,17 +119,14 @@ func (action *AttestationPush) Run(ctx context.Context, attestationID string, ru // 2 - Populate annotation values from the ones provided at runtime // a) we do not allow overriding values that come from the contract - // b) we do not allow adding annotations that are not defined in the contract + // b) we allow runtime annotations not specified in the contract for kr, vr := range runtimeAnnotations { - // If the annotation is not defined in the material we fail - if v, found := craftedAnnotations[kr]; !found { - return nil, fmt.Errorf("annotation %q not found", kr) - } else if v == "" { + if v, found := craftedAnnotations[kr]; found && v != "" { + // NOTE: we do not allow overriding values that come from the contract + action.Logger.Info().Str("annotation", kr).Msg("contract annotation can't be changed, skipping") + } else { // Set it only if it's not set craftedAnnotations[kr] = vr - } else { - // NOTE: we do not allow overriding values that come from the contract - action.Logger.Info().Str("annotation", kr).Msg("annotation can't be changed, skipping") } }