MCPcopy Create free account
hub / github.com/conforma/cli / SetImageSignatureCheckFromError

Method SetImageSignatureCheckFromError

internal/output/output.go:117–139  ·  view source on GitHub ↗

SetImageSignatureCheck sets the passed and result.message fields of the ImageSignatureCheck to the given values.

(err error)

Source from the content-addressed store, hash-verified

115
116// SetImageSignatureCheck sets the passed and result.message fields of the ImageSignatureCheck to the given values.
117func (o *Output) SetImageSignatureCheckFromError(err error) {
118 metadata := map[string]interface{}{
119 "code": "builtin.image.signature_check",
120 "title": "Image signature check passed",
121 "description": "The image signature matches available signing materials.",
122 }
123 var message string
124
125 if err == nil {
126 o.ImageSignatureCheck.Passed = true
127 message = "Pass"
128 log.Debug("Image signature check passed")
129 } else {
130 o.ImageSignatureCheck.Passed = false
131 message = wrapCosignErrorMessage(err, "signature", o.Policy)
132 log.Debug(message)
133 }
134 result := &evaluator.Result{Message: message, Metadata: metadata}
135 if !o.Detailed {
136 keepSomeMetadataSingle(*result)
137 }
138 o.ImageSignatureCheck.Result = result
139}
140
141// SetAttestationSignatureCheck sets the passed and result.message fields of the AttestationSignatureCheck to the given values.
142func (o *Output) SetAttestationSignatureCheckFromError(err error) {

Callers 2

ValidateImageFunction · 0.95

Calls 2

wrapCosignErrorMessageFunction · 0.85
keepSomeMetadataSingleFunction · 0.85

Tested by 1