I could theoretically put the config for this feature directly into TRIGGER_CI, but that would require making it a dict and so it wouldn't preserve backwards compatibility.
TRIGGER_CI
I'll implement tests once I get a thumbsup on the general approach.
The approach looks okay to me, but I'd defer to @pingou and @ryanlerch...
An idea for preserving backwards compatibility while utilizing TRIGGER_CI - if TRIGGER_CI is a list, assume there's no way to rerun any CIs. If it's a dict, utilize all of its keys that don't have None as a value for buttons that retrigger CIs.
None
Additionally, I think it might make sense to include more data, e.g. a text for tooltip that would pop up on mouse-over to explain what rerunning a specific CI means.
Does these make sense?
How about: - If it's a list, assume pagure-ci - If it's a dict, use the new behavior Would that not work?
+1, since it is a dict we can embed more info in it
Does to me! :)
rebased onto b8f7b5f0ca952ec4f54759ec0378d63d82025d9f
rebased onto 4ace0241af724ec2d9b24874148f4a66f74bca73
Improved, rebased and tests added. Ready for review @pingou :)
Hm, this is going to show the re-run button on all projects while on pagure.io this would have an effect only on the project that have configured pagure-ci. I don't see a way around this other than adding a global configuration key
I'm not that familiar with pagure.io and pagure-ci. Is there a way to tell if it is enabled for a project?
Ok, so IIUC we'd need to figure out if the pagure_ci hook is enabled for the project, right? I'll try to think of a sensible way of doing this.
pagure_ci
Ok, so IIUC we'd need to figure out if the pagure_ci hook is enabled for the project, right?
Yes
I'll try to think of a sensible way of doing this.
Check how we check any other hooks, should be the same approach. It might be simpler to check this in the controller than in the template fwiw
Yeah, I'm just trying to figure out whether it'd be possible to do it generally, e.g. adding something to the config value like "requires_hook": "PagureCi". I'll try doing something along those lines.
"requires_hook": "PagureCi"
rebased onto e500d1dab8cdf1301dbca540eb0c1fc715a221d5
rebased onto 27440c6c648b709135a7477cf0f74d40a7cb5313
@pingou implemented and ready for re-review.
@bkabrda could you provide some gif or animation to show what this looks like?
@ngompa here you go: https://bkabrda.fedorapeople.org/rerun-ci.webm
I also just realized that this shouldn't show up for users who aren't logged in, I'll fix that.
rebased onto c600dc15ae903a58364e51440745d08266261aff
Fixed, the button will now only show for users that are logged in.
:thumbsup:
I have on small change for this to work fully:
diff --git a/ pagure/lib/query.py b/ pagure/lib/query.py index b4ef6aab..b08e2044 100644 --- a/ pagure/lib/query.py +++ b/ pagure/lib/query.py @@ -1369,6 +1369,7 @@ def add_pull_request_comment( # Send notification to the CI server, if the comment added was a # notification and the PR is still open and project is not private + ci_triggered = False if ( notification and request.status == "Open" @@ -1383,6 +1384,7 @@ def add_pull_request_comment( branch=request.branch_from, ci_type=request.project.ci_hook.ci_type, ) + ci_triggered = True pagure.lib.notify.log( request.project, @@ -1394,7 +1396,8 @@ def add_pull_request_comment( ) if ( - trigger_ci + not ci_triggered + and trigger_ci and comment.strip().lower() in trigger_ci and pagure_config.get("PAGURE_CI_SERVICES") and request.project.ci_hook
rebased onto 0915d04a8786654e597937187e6052871ceae613
Added and rebased on top of #3970.
rebased onto a80d7c43283d09509dc2fb562cf5af17af8b0425
Pull-Request has been merged by pingou
I could theoretically put the config for this feature directly into
TRIGGER_CI, but that would require making it a dict and so it wouldn't preserve backwards compatibility.I'll implement tests once I get a thumbsup on the general approach.