Skip to content

Commit c496a81

Browse files
authored
feat: gated attestation add (#2623)
Signed-off-by: Sylwester Piskozub <[email protected]>
1 parent c163bf7 commit c496a81

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

app/cli/cmd/attestation_add.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,22 @@ func newAttestationAddCmd() *cobra.Command {
119119
return err
120120
}
121121

122-
return output.EncodeOutput(flagOutputFormat, resp, func(s *action.AttestationStatusMaterial) error {
122+
if err := output.EncodeOutput(flagOutputFormat, resp, func(s *action.AttestationStatusMaterial) error {
123123
return displayMaterialInfo(s, policies[resp.Name])
124-
})
124+
}); err != nil {
125+
return err
126+
}
127+
128+
// Check for gated policy violations
129+
for _, evaluations := range policies {
130+
for _, eval := range evaluations {
131+
if len(eval.Violations) > 0 && eval.Gate {
132+
return NewGateError(eval.Name)
133+
}
134+
}
135+
}
136+
137+
return nil
125138
},
126139
)
127140
},

0 commit comments

Comments
 (0)