PrProcessor » History » Version 3
Dominic Cleal, 10/29/2015 11:37 AM
needs testing label
1 | 1 | Dominic Cleal | h1. PR Processor |
---|---|---|---|
2 | |||
3 | prprocessor is a web service hosted on the project's OpenShift account, which receives GitHub webhooks/notifications and helps sync PRs to Redmine and Jenkins. |
||
4 | |||
5 | It's a simple Sinatra app, and the source is available here: https://github.com/theforeman/prprocessor. |
||
6 | |||
7 | h2. OpenShift |
||
8 | |||
9 | It runs on OpenShift using a group account, to which a few developers have push access to. When merging into the GitHub repository, please keep this in sync with OpenShift's repo by pushing to both. |
||
10 | |||
11 | h2. GitHub integration |
||
12 | |||
13 | It receives requests from GitHub when pull requests are opened or synchronized (updated). These contain lots of info about the PR, including the author, branches etc. A repository admin needs to add the webhook to send these events - more information on the "Jenkins":http://projects.theforeman.org/projects/foreman/wiki/Jenkins#PR-scanner-repo-hooks wiki page. |
||
14 | |||
15 | 2 | Dominic Cleal | It sets labels and performs checks on the PR to ensure it meets our usual standards. |
16 | 1 | Dominic Cleal | |
17 | 2 | Dominic Cleal | h3. Labels |
18 | |||
19 | When a PR is first opened, it sets: |
||
20 | |||
21 | * _Not yet reviewed_ |
||
22 | * _Needs testing_ |
||
23 | |||
24 | When a PR is updated, it: |
||
25 | |||
26 | * Removes any _Waiting on contributor_ label |
||
27 | 3 | Dominic Cleal | * Sets _Needs testing_ |
28 | 2 | Dominic Cleal | * If the _Not yet reviewed_ label is missing, it sets _Needs re-review_ |
29 | |||
30 | This encourages the workflow for reviewers to remove the _Not yet reviewed_ label when they've made the first review. When the PR is updated, it gets _Needs re-review_ so they can attend to it sooner, before starting on new PRs. |
||
31 | |||
32 | 1 | Dominic Cleal | h3. Commit message styles |
33 | |||
34 | For repositories in the "redmine_issue_required_repos.yaml":https://github.com/theforeman/prprocessor/blob/master/config/redmine_issue_required_repos.yaml list, it enforces that: |
||
35 | |||
36 | # Commit messages match the style in [[Reviewing_patches-commit_message_format]] |
||
37 | # A Redmine ticket is referenced in the commit message |
||
38 | |||
39 | 2 | Dominic Cleal | If it fails this check, it will add the _Waiting on contributor_ label and leave a comment. |
40 | |||
41 | 1 | Dominic Cleal | h3. PR is mergeable |
42 | |||
43 | It checks whether the PR is mergeable against the branch it's proposed for. This will only pick up this error when the PR is updated because the service is event-driven, so it won't notify authors when a PR goes out of sync due to master/develop being changed, and the PR is not updated. |
||
44 | 2 | Dominic Cleal | |
45 | If it fails this check, it will replace any waiting review labels with the _Waiting on contributor_ label and leave a comment. |
||
46 | 1 | Dominic Cleal | |
47 | h2. Redmine integration |
||
48 | |||
49 | When it receives an event, the corresponding Redmine ticket is updated to link it to the pull request. The script updates these fields: |
||
50 | |||
51 | # _Status_ is changed to _Ready for Testing_ |
||
52 | # _Assigned To_ is changed to the PR author - update "users.yaml":https://github.com/theforeman/prprocessor/blob/master/config/users.yaml for new or unknown developers |
||
53 | # _Target version_ (usually sprints) is set to the latest available version |
||
54 | # _Pull request_ is set to the URL of the PR |
||
55 | |||
56 | h2. Jenkins integration |
||
57 | |||
58 | A "PR scanner" job runs regularly on Jenkins and is responsible for all checking, testing and updating of pull requests. Since it uses a lot of API queries, it only runs every 30 minutes. More about this job is on the "Jenkins wiki page":http://projects.theforeman.org/projects/foreman/wiki/Jenkins#PR-scanner. |
||
59 | |||
60 | To get faster PR testing, when a PR hook is received by the prprocessor, it triggers an immediate run/build of the Jenkins scanner job against the relevant PR. No further action is taken by the prprocessor. |