Skip to content

Commit a4b7119

Browse files
committed
src: lava_callback: handle artifacts uploaded from test jobs
Test jobs might need to upload artifacts directly from LAVA (this is needed e.g. for GCOV data when checking for code coverage), but we currently have no way to add those artifacts to the corresponding node. Add such a feature in a rather generic way, so jobs can provide both the artifact name and its URL through a specially-formatted result entry: artifact-upload:<artifact name>:<artifact URL> Therefore, all test results starting with `artifact-upload:` will be processed and stored in the corresponding node's `artifacts` dict, with `<artifact name>` being the entry key and `<artifact URL>` being its value. Signed-off-by: Arnaud Ferraris <[email protected]>
1 parent 2630caf commit a4b7119

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/lava_callback.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,16 @@ def async_job_submit(api_helper, node_id, job_callback):
233233
job_node['error_msg'] = None
234234
if device_id:
235235
job_node['data']['device'] = device_id
236+
# add artifacts uploaded from the running LAVA job
237+
upload_result = results.pop('upload', {})
238+
for (name, state) in upload_result.items():
239+
if name.startswith("artifact-upload:") and state == 'pass':
240+
artifact = name.split(':', 2)
241+
if len(artifact) != 3:
242+
logger.warn(f"Failed to extract artifact name and URL from {result}")
243+
continue
244+
job_node['artifacts'][artifact[1]] = artifact[2]
245+
logger.info(f"Artifact {artifact[1]} added with URL {artifact[2]}")
236246
hierarchy = job_callback.get_hierarchy(results, job_node)
237247
api_helper.submit_results(hierarchy, job_node)
238248

0 commit comments

Comments
 (0)