Skip to content

Commit

Permalink
src/send_kcidb: send job URL for test submissions
Browse files Browse the repository at this point in the history
Update function to get job metadata to fetch
lava job URLs and send them in `environment.misc.job_url`
field for test submissions.

Signed-off-by: Jeny Sadadia <jeny.sadadia@collabora.com>
  • Loading branch information
Jeny Sadadia authored and JenySadadia committed Sep 23, 2024
1 parent c5188c0 commit 394b656
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/send_kcidb.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@
'Test',
)

lava_labs = {
"lava-baylibre": "https://lava.baylibre.com",
"lava-broonie": "https://lava.sirena.org.uk",
"lava-collabora": "https://lava.collabora.dev",
"lava-collabora-early-access": "https://staging.lava.collabora.dev",
"lava-collabora-staging": "https://staging.lava.collabora.dev",
}


class KCIDBBridge(Service):
def __init__(self, configs, args, name):
Expand Down Expand Up @@ -308,16 +316,20 @@ def _get_artifacts(self, node):

def _get_job_metadata(self, node):
"""Retrive job metadata
Get job metadata such as job ID and context. If the node doesn't
have the metadata, it will search through parent nodes recursively
until it's found.
Get job metadata such as job ID, context, and job URL (for lava jobs).
If the node doesn't have the metadata, it will search through parent nodes
recursively until it's found.
"""
data = node.get('data')
if not data.get('job_id'):
if node.get('parent'):
parent = self._api.node.get(node['parent'])
if parent:
data = self._get_job_metadata(parent)
lab_url = lava_labs.get(data.get('runtime'))
if lab_url:
job_url = lab_url + "/scheduler/job/" + data.get('job_id')
data['job_url'] = job_url
return data

def _get_error_metadata(self, node):
Expand Down Expand Up @@ -391,6 +403,8 @@ def _parse_test_node(self, origin, test_node):
'job_id')
parsed_test_node['environment']['misc']['job_context'] = job_metadata.get(
'job_context')
parsed_test_node['environment']['misc']['job_url'] = job_metadata.get(
'job_url')

artifacts = self._get_artifacts(test_node)
if artifacts:
Expand Down

0 comments on commit 394b656

Please sign in to comment.