(builderInfo *builderInfo, att *v1.Attestation)
| 176 | } |
| 177 | |
| 178 | func 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 | |
| 224 | func getChainloopMeta(att *v1.Attestation) *Metadata { |
| 225 | initializedAt := att.InitializedAt.AsTime() |
no test coverage detected