@@ -253,7 +253,7 @@ func (b *Backend) createOccurrence(ctx context.Context, obj objects.TektonObject
253253 }
254254
255255 // create Occurrence_Build for TaskRun
256- allURIs := extract . RetrieveAllArtifactURIs (ctx , obj , b . cfg . Artifacts . PipelineRuns . DeepInspectionEnabled )
256+ allURIs := b . getAllArtifactURIs (ctx , opts . PayloadFormat , obj )
257257 for _ , uri := range allURIs {
258258 occ , err := b .createBuildOccurrence (ctx , obj , payload , signature , uri )
259259 if err != nil {
@@ -264,6 +264,22 @@ func (b *Backend) createOccurrence(ctx context.Context, obj objects.TektonObject
264264 return occs , nil
265265}
266266
267+ func (b * Backend ) getAllArtifactURIs (ctx context.Context , payloadFormat config.PayloadType , obj objects.TektonObject ) []string {
268+ logger := logging .FromContext (ctx )
269+ payloader , err := formats .GetPayloader (payloadFormat , b .cfg )
270+ if err != nil {
271+ logger .Infof ("couldn't get payloader for %v format, will use extract.RetrieveAllArtifactURIs method instead" , payloadFormat )
272+ return extract .RetrieveAllArtifactURIs (ctx , obj , b .cfg .Artifacts .PipelineRuns .DeepInspectionEnabled )
273+ }
274+
275+ if uris , err := payloader .RetrieveAllArtifactURIs (ctx , obj ); err == nil {
276+ return uris
277+ }
278+
279+ logger .Infof ("couldn't get URIs from payloader %v, will use extract.RetrieveAllArtifactURIs method instead" , payloadFormat )
280+ return extract .RetrieveAllArtifactURIs (ctx , obj , b .cfg .Artifacts .PipelineRuns .DeepInspectionEnabled )
281+ }
282+
267283func (b * Backend ) createAttestationOccurrence (ctx context.Context , payload []byte , signature string , uri string ) (* pb.Occurrence , error ) {
268284 occurrenceDetails := & pb.Occurrence_Attestation {
269285 Attestation : & pb.AttestationOccurrence {
@@ -364,7 +380,7 @@ func (b *Backend) getBuildNotePath(obj objects.TektonObject) string {
364380func (b * Backend ) getAllOccurrences (ctx context.Context , obj objects.TektonObject , opts config.StorageOpts ) ([]* pb.Occurrence , error ) {
365381 result := []* pb.Occurrence {}
366382 // step 1: get all resource URIs created under the taskrun
367- uriFilters := extract . RetrieveAllArtifactURIs (ctx , obj , b . cfg . Artifacts . PipelineRuns . DeepInspectionEnabled )
383+ uriFilters := b . getAllArtifactURIs (ctx , opts . PayloadFormat , obj )
368384
369385 // step 2: find all build occurrences
370386 if _ , ok := formats .IntotoAttestationSet [opts .PayloadFormat ]; ok {
0 commit comments