Skip to content

Commit 2066052

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 9af0245 commit 2066052

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
@@ -234,6 +234,16 @@ def async_job_submit(api_helper, node_id, job_callback):
234234
job_node['error_msg'] = None
235235
if device_id:
236236
job_node['data']['device'] = device_id
237+
# add artifacts uploaded from the running LAVA job
238+
upload_result = results.pop('upload', {})
239+
for (name, state) in upload_result.items():
240+
if name.startswith("artifact-upload:") and state == 'pass':
241+
artifact = name.split(':', 2)
242+
if len(artifact) != 3:
243+
logger.warn(f"Failed to extract artifact name and URL from {result}")
244+
continue
245+
job_node['artifacts'][artifact[1]] = artifact[2]
246+
logger.info(f"Artifact {artifact[1]} added with URL {artifact[2]}")
237247
hierarchy = job_callback.get_hierarchy(results, job_node)
238248
api_helper.submit_results(hierarchy, job_node)
239249

0 commit comments

Comments
 (0)