MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / predicateCommon

Function predicateCommon

pkg/attestation/renderer/chainloop/chainloop.go:178–222  ·  view source on GitHub ↗
(builderInfo *builderInfo, att *v1.Attestation)

Source from the content-addressed store, hash-verified

176}
177
178func predicateCommon(builderInfo *builderInfo, att *v1.Attestation) *ProvenancePredicateCommon {
179 var (
180 environment string
181 authenticated bool
182 workflowFilePath string
183 auth *Auth
184 casBackend *CASBackend
185 )
186
187 if att.RunnerEnvironment != nil {
188 environment = att.RunnerEnvironment.GetEnvironment()
189 authenticated = att.RunnerEnvironment.GetAuthenticated()
190 workflowFilePath = att.RunnerEnvironment.GetWorkflowFilePath()
191 }
192
193 if att.Auth != nil {
194 auth = &Auth{
195 ID: att.Auth.GetId(),
196 Type: att.Auth.GetType().String(),
197 }
198 }
199
200 if att.CasBackend != nil {
201 casBackend = &CASBackend{
202 CASBackendID: att.CasBackend.CasBackendId,
203 CASBackendName: att.CasBackend.CasBackendName,
204 Fallback: att.CasBackend.Fallback,
205 }
206 }
207
208 return &ProvenancePredicateCommon{
209 BuildType: chainloopBuildType,
210 Builder: &builder{ID: fmt.Sprintf(builderIDFmt, builderInfo.version, builderInfo.digest)},
211 Metadata: getChainloopMeta(att),
212 Env: att.EnvVars,
213 RunnerType: att.GetRunnerType().String(),
214 RunnerURL: att.GetRunnerUrl(),
215 Annotations: att.Annotations,
216 RunnerEnvironment: environment,
217 RunnerAuthenticated: authenticated,
218 RunnerWorkflowFilePath: workflowFilePath,
219 Auth: auth,
220 CASBackend: casBackend,
221 }
222}
223
224func getChainloopMeta(att *v1.Attestation) *Metadata {
225 initializedAt := att.InitializedAt.AsTime()

Callers 1

predicateMethod · 0.85

Calls 9

getChainloopMetaFunction · 0.85
GetAuthenticatedMethod · 0.80
GetWorkflowFilePathMethod · 0.80
GetRunnerUrlMethod · 0.80
StringMethod · 0.65
GetEnvironmentMethod · 0.45
GetIdMethod · 0.45
GetTypeMethod · 0.45
GetRunnerTypeMethod · 0.45

Tested by

no test coverage detected