1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

fix merge error

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
This commit is contained in:
Jim Bugwadia 2021-10-06 22:48:56 -07:00
parent 7c761b4bc9
commit 1c0a303106
2 changed files with 6 additions and 6 deletions

View file

@ -175,7 +175,7 @@ func (iv *imageVerifier) attestImage(repository, key string, imageInfo *context.
statements, err := cosign.FetchAttestations(image, []byte(key), repository)
if err != nil {
iv.logger.Info("failed to fetch attestations", "image", image, "error", err, "duration", time.Since(start).Seconds())
return ruleError(iv.rule, fmt.Sprintf("failed to fetch attestations for %s", image), err)
return ruleError(iv.rule, utils.ImageVerify, fmt.Sprintf("failed to fetch attestations for %s", image), err)
}
iv.logger.V(3).Info("received attested statements", "statements", statements)
@ -186,13 +186,13 @@ func (iv *imageVerifier) attestImage(repository, key string, imageInfo *context.
if ac.PredicateType == predicateType {
val, err := iv.checkAttestations(ac, s, imageInfo)
if err != nil {
return ruleError(iv.rule, "error while checking attestation", err)
return ruleError(iv.rule, utils.ImageVerify, "error while checking attestation", err)
}
if !val {
msg := fmt.Sprintf("attestation checks failed for %s and predicate %s", imageInfo.String(), predicateType)
iv.logger.Info(msg)
return ruleResponse(iv.rule, msg, response.RuleStatusFail)
return ruleResponse(iv.rule, utils.ImageVerify, msg, response.RuleStatusFail)
}
}
}
@ -200,7 +200,7 @@ func (iv *imageVerifier) attestImage(repository, key string, imageInfo *context.
msg := fmt.Sprintf("attestation checks passed for %s", imageInfo.String())
iv.logger.V(2).Info(msg)
return ruleResponse(iv.rule, msg, response.RuleStatusPass)
return ruleResponse(iv.rule, utils.ImageVerify, msg, response.RuleStatusPass)
}
func (iv *imageVerifier) checkAttestations(a *v1.Attestation, s map[string]interface{}, img *context.ImageInfo) (bool, error) {

View file

@ -20,8 +20,8 @@ const (
Validation
//Generation type for generation rule
Generation
//All type for other rule operations(future)
All
// ImageVerify type for image verification
ImageVerify
)
func (ri RuleType) String() string {