ansible / ansibullbot

Bot for management of Ansible issues and PRs on GitHub.
GNU General Public License v3.0
203 stars 126 forks source link

Automate handling of PRs labeled needs_ci #1029

Open mattclay opened 6 years ago

mattclay commented 6 years ago

The bot already identifies pull requests which need CI by labeling them with the needs_ci label. The next logical step is to automate resolution of this situation to avoid manual intervention.

The bot should automatically close and re-open a pull request which is labeled needs_ci (although not immediately upon label application, see below for further details). When closing the pull request a comment should also be added, such as:

Closing and re-opening to trigger CI.

The bot should attempt this a limited number of times and not too soon after a previous attempt. Looking at its own "closing" comments on the pull request is probably the easiest way to limit this.

I suggest using an increasingly larger delay between each request, perhaps starting at 30 minutes after needs_ci was first applied and then doubling the delay each time until 7 attempts have been made. This would account for any typical service outage or disruption.

mattclay commented 6 years ago

Initially this only needs to be implemented for Shippable. A future update will be required to implement this feature for Zuul.

gundalow commented 6 years ago

Is there we hook we could fire to trigger Shippable jobs rather than close/open

+1 to backoff timer

gundalow commented 6 years ago

Perhaps http://docs.shippable.com/platform/api/api-overview/#!/Runs/post_projects_projectId_newBuild

mattclay commented 6 years ago

Unfortunately the only way to trigger a PR build for the first time is to have GitHub send the webhook. The easiest (and sometimes only) way to do that is closing and re-opening a PR.