Comment on git force that originated the pipeline#50
Conversation
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.
Not sure if this helps, but it replies with something like this. For example: |
| req_params["ref"] = "main" | ||
| r = requests.post(config['gitlab_trigger_url'], | ||
| data=req_params) | ||
| safe_params = req_params |
There was a problem hiding this comment.
You need req_params.copy() here, otherwise it will still point at the same mutable object, and will get the token too...
| import hashlib | ||
| from flask import Flask, request, Response | ||
|
|
||
| from lib.github_api import GitHubIssue |
There was a problem hiding this comment.
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...
| 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) | ||
|
|
There was a problem hiding this comment.
Don't move it after making extra requests above.
|
I have a better idea: use "deployments" instead of comments, will less clutter discussion on a PR. Let me try |
|
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... |
|
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...) |
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.