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

Extend node.submitter #778

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion src/lava_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ async def checkout(data: ManualCheckout, request: Request,
}
},
"timeout": checkout_timeout.isoformat(),
"submitter": f'user:{email}',
}

if jobfilter:
Expand Down Expand Up @@ -541,7 +542,7 @@ def validate_patch_url(patchurl):


@app.post('/api/patchset')
async def checkout(data: PatchSet, request: Request,
async def patchset(data: PatchSet, request: Request,
Authorization: str = Header(None)):
'''
API call to test existing checkout with a patch(set)
Expand Down Expand Up @@ -616,6 +617,7 @@ async def checkout(data: PatchSet, request: Request,
newnode['parent'] = node['id']
newnode['artifacts'] = {}
newnode['timeout'] = patchset_timeout.isoformat()
newnode['submitter'] = f'user:{email}'
if data.patchurl:
for i, patchurl in enumerate(data.patchurl):
newnode['artifacts'][f'patch{i}'] = patchurl
Expand Down
7 changes: 7 additions & 0 deletions src/send_kcidb.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __init__(self, configs, args, name):
super().__init__(configs, args, name)
self._jobs = configs['jobs']
self._platforms = configs['platforms']
self._current_user = self._api.user.whoami()

def _setup(self, args):
return {
Expand Down Expand Up @@ -450,6 +451,12 @@ def _run(self, context):
node, is_hierarchy = self._api_helper.receive_event_node(context['sub_id'])
self.log.info(f"Received an event for node: {node['id']}")

# Submit nodes with service origin only for staging pipeline
if self._current_user['username'] == 'staging':
if node['submitter'] != 'service:pipeline':
self.log.debug(f"Not sending node to KCIDB: {node['id']}")
continue

parsed_checkout_node = []
parsed_build_node = []
parsed_test_node = []
Expand Down
3 changes: 3 additions & 0 deletions src/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def _run_trigger(self, build_config, force, timeout, trees):
},
'timeout': checkout_timeout.isoformat(),
}
if self._current_user['username'] == 'staging':
node['submitter'] = 'service:pipeline'

try:
self._api.node.add(node)
except requests.exceptions.HTTPError as ex:
Expand Down
Loading