Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions app/cli/internal/action/attestation_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
Loading