@@ -190,13 +190,13 @@ def _parse_checkout_node(self, origin, checkout_node):
190
190
}
191
191
}]
192
192
193
- def _get_input_files (self , artifacts : dict , exclude_properties = None ):
193
+ def _filter_artifacts (self , artifacts : dict , exclude_properties = None ,
194
+ include_properties = None ):
194
195
input_files = []
195
196
for name , url in artifacts .items ():
196
- if exclude_properties and name in exclude_properties :
197
+ if exclude_properties and any ( prop in name for prop in exclude_properties ) :
197
198
continue
198
- if not name .startswith ('input_' ):
199
- # Skip output files
199
+ if include_properties and not any (prop in name for prop in include_properties ):
200
200
continue
201
201
# Replace "/" with "_" to match with the allowed pattern
202
202
# for "name" property of "input_files" i.e. '^[^/]+$'
@@ -209,25 +209,6 @@ def _get_input_files(self, artifacts: dict, exclude_properties=None):
209
209
)
210
210
return input_files
211
211
212
- def _get_output_files (self , artifacts : dict , exclude_properties = None ):
213
- output_files = []
214
- for name , url in artifacts .items ():
215
- if exclude_properties and name in exclude_properties :
216
- continue
217
- if name .startswith ('input_' ):
218
- # Skip input files
219
- continue
220
- # Replace "/" with "_" to match with the allowed pattern
221
- # for "name" property of "output_files" i.e. '^[^/]+$'
222
- name = name .replace ("/" , "_" )
223
- output_files .append (
224
- {
225
- 'name' : name ,
226
- 'url' : url
227
- }
228
- )
229
- return output_files
230
-
231
212
def _get_log_excerpt (self , log_url ):
232
213
"""Parse compressed(gzip) or text log file and return last 16*1024 characters as it's
233
214
the maximum allowed length for KCIDB `log_excerpt` field"""
@@ -558,13 +539,13 @@ def _parse_test_node(self, origin, test_node):
558
539
559
540
artifacts = self ._get_artifacts (test_node )
560
541
if artifacts :
561
- parsed_test_node ['input_files' ] = self ._get_input_files (
542
+ parsed_test_node ['input_files' ] = self ._filter_artifacts (
562
543
artifacts = artifacts ,
563
- exclude_properties = None
544
+ include_properties = ( 'input_' )
564
545
)
565
- parsed_test_node ['output_files' ] = self ._get_output_files (
546
+ parsed_test_node ['output_files' ] = self ._filter_artifacts (
566
547
artifacts = artifacts ,
567
- exclude_properties = ('lava_log' , 'test_log' )
548
+ exclude_properties = ('lava_log' , 'test_log' , 'input_' )
568
549
)
569
550
if artifacts .get ('lava_log' ):
570
551
parsed_test_node ['log_url' ] = artifacts .get ('lava_log' )
0 commit comments