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

Function populateMaterials

app/cli/pkg/action/attestation_status.go:211–225  ·  view source on GitHub ↗

populateMaterials populates the materials in the attestation result regardless of where they are defined (contract schema or inline in the attestation)

(craftingState *v1.CraftingState, res *AttestationStatusResult)

Source from the content-addressed store, hash-verified

209// populateMaterials populates the materials in the attestation result regardless of where they are defined
210// (contract schema or inline in the attestation)
211func populateMaterials(craftingState *v1.CraftingState, res *AttestationStatusResult) error {
212 visitedMaterials := make(map[string]struct{})
213 attsMaterials := craftingState.GetAttestation().GetMaterials()
214 inputSchemaMaterials := craftingState.GetMaterials()
215
216 if err := populateContractMaterials(inputSchemaMaterials, attsMaterials, res, visitedMaterials); err != nil {
217 return fmt.Errorf("adding materials from the contract: %w", err)
218 }
219
220 if err := populateAdditionalMaterials(attsMaterials, res, visitedMaterials); err != nil {
221 return fmt.Errorf("adding materials outside the contract: %w", err)
222 }
223
224 return nil
225}
226
227// populateContractMaterials populates the materials that are defined in the contract schema
228func populateContractMaterials(inputSchemaMaterials []*pbc.CraftingSchema_Material, attsMaterial map[string]*v1.Attestation_Material, res *AttestationStatusResult, visitedMaterials map[string]struct{}) error {

Callers 3

RunMethod · 0.85

Calls 4

GetMaterialsMethod · 0.65
GetAttestationMethod · 0.45

Tested by 2