Skip to content

Comment on git force that originated the pipeline#50

Closed
ben-grande wants to merge 1 commit into
QubesOS:mainfrom
ben-grande:comment-github
Closed

Comment on git force that originated the pipeline#50
ben-grande wants to merge 1 commit into
QubesOS:mainfrom
ben-grande:comment-github

Conversation

@ben-grande
Copy link
Copy Markdown
Contributor

Bit difficult to do without being able to test results iteratively. I've read https://docs.github.com/en/rest/issues/comments. I didn't find on https://open.qa/docs/#_use_of_the_rest_api if "openqa-cli api -X post" replied with the job url.


Can't know if this works..., but just sharing an idea.

Bit difficult to do without being able to test results iteratively.
I've read https://docs.github.com/en/rest/issues/comments. I didn't find
on https://open.qa/docs/#_use_of_the_rest_api if "openqa-cli api -X
post" replied with the job url.
@deeplow
Copy link
Copy Markdown
Contributor

deeplow commented Feb 3, 2026

I didn't find on https://open.qa/docs/#_use_of_the_rest_api if "openqa-cli api -X post" replied with the job url.

Not sure if this helps, but it replies with something like this.

For example: {"count":3,"failed":[],"ids":[166148,166149,166150],"scheduled_product_id":3950} is what returned from a recent run. So you can just grab the test IDs and put them in openqa.qubes-os.org/tests/{job_id}

Comment thread api/gitlab_api.py
req_params["ref"] = "main"
r = requests.post(config['gitlab_trigger_url'],
data=req_params)
safe_params = req_params
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need req_params.copy() here, otherwise it will still point at the same mutable object, and will get the token too...

Comment thread api/gitlab_api.py
import hashlib
from flask import Flask, request, Response

from lib.github_api import GitHubIssue
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work, the script is called in the api dir, so it doesn't see lib in PYTHONPATH. But posting a comment is a single POST request, so IMO it's okay open-code it...

Comment thread api/gitlab_api.py
Comment on lines +324 to +328
if 'PR_LABEL' in comment_params:
if not re.match(r"\A[a-z0-9-]+\Z", comment_params['PR_LABEL']):
return respond(400, "invalid LABEL value")
return schedule_pr_build(comment_params, html_url, issue_url)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't move it after making extra requests above.

@marmarek
Copy link
Copy Markdown
Member

marmarek commented May 5, 2026

I have a better idea: use "deployments" instead of comments, will less clutter discussion on a PR. Let me try

@marmarek
Copy link
Copy Markdown
Member

marmarek commented May 5, 2026

It works: QubesOS/qubes-core-admin#783 (comment)

But, it needs more access to the repo, and using "personal access token" that means full write access, which I don't like :/ I guess I'll need to convert it to proper github app, which can be better scoped, that's extra 50 lines to this file...

@marmarek
Copy link
Copy Markdown
Member

marmarek commented May 5, 2026

It's done here: 95d7fe9 . I like it better than comments (less notifications spam), but might be weird at times (the link is under "Deployed" word, using "environment_url" has some interaction with github logic and seems to be hidden in some states...)

@marmarek marmarek closed this May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants