Skip to content

Commit a01d1d5

Browse files
committed
Feat: send input artifacts to KCIDB
Signed-off-by: Simone Tollardo <[email protected]>
1 parent 564e11d commit a01d1d5

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

src/send_kcidb.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,33 @@ def _parse_checkout_node(self, origin, checkout_node):
190190
}
191191
}]
192192

193+
def _get_input_files(self, artifacts: dict, exclude_properties=None):
194+
input_files = []
195+
for name, url in artifacts.items():
196+
if exclude_properties and name in exclude_properties:
197+
continue
198+
if "input_" not in name:
199+
# Skip output files
200+
continue
201+
# Replace "/" with "_" to match with the allowed pattern
202+
# for "name" property of "input_files" i.e. '^[^/]+$'
203+
name = name.replace("/", "_")
204+
input_files.append(
205+
{
206+
'name': name,
207+
'url': url
208+
}
209+
)
210+
return input_files
211+
193212
def _get_output_files(self, artifacts: dict, exclude_properties=None):
194213
output_files = []
195214
for name, url in artifacts.items():
196215
if exclude_properties and name in exclude_properties:
197216
continue
217+
if "input_" in name:
218+
# Skip input files
219+
continue
198220
# Replace "/" with "_" to match with the allowed pattern
199221
# for "name" property of "output_files" i.e. '^[^/]+$'
200222
name = name.replace("/", "_")
@@ -312,7 +334,10 @@ def _parse_build_node(self, origin, node):
312334
artifacts=artifacts,
313335
exclude_properties=('build_log', '_config')
314336
)
315-
parsed_build_node['input_files'] = None
337+
parsed_build_node['input_files'] = self._get_input_files(
338+
artifacts=artifacts,
339+
exclude_properties=None
340+
)
316341
parsed_build_node['config_url'] = artifacts.get('_config')
317342
parsed_build_node['log_url'] = artifacts.get('build_log')
318343
log_url = parsed_build_node['log_url']
@@ -537,11 +562,14 @@ def _parse_test_node(self, origin, test_node):
537562

538563
artifacts = self._get_artifacts(test_node)
539564
if artifacts:
565+
parsed_test_node['input_files'] = self._get_input_files(
566+
artifacts=artifacts,
567+
exclude_properties=None
568+
)
540569
parsed_test_node['output_files'] = self._get_output_files(
541570
artifacts=artifacts,
542571
exclude_properties=('lava_log', 'test_log')
543572
)
544-
parsed_test_node['input_files'] = None
545573
if artifacts.get('lava_log'):
546574
parsed_test_node['log_url'] = artifacts.get('lava_log')
547575
else:

0 commit comments

Comments
 (0)