Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/send_kcidb.py: Extract patchset hash from patchwork metadata #299

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/send_kcidb.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ def _set_timezone(created_timestamp):
created_time.timestamp(), tz=tz_utc)
return created_time.isoformat()

def _get_patchset_hash(node_data):
if not node_data:
return ""

if patchwork_metadata := node_data.get('patchwork'):
if patchwork_metadata['version'] == 1:
return patchwork_metadata['payload']['patches'][0]['hash']

return ""

def _run(self, context):
self.log.info("Listening for events... ")
self.log.info("Press Ctrl-C to stop.")
Expand All @@ -76,7 +86,7 @@ def _run(self, context):
'git_commit_hash': node['revision']['commit'],
'git_repository_branch': node['revision']['branch'],
'start_time': self._set_timezone(node['created']),
'patchset_hash': '',
'patchset_hash': self._get_patchset_hash(node.get('data')),
'misc': {
'submitted_by': 'kernelci-pipeline'
},
Expand Down