Skip to content

Commit

Permalink
Add better documentation for GH orgs and branch properties
Browse files Browse the repository at this point in the history
  • Loading branch information
saville committed Dec 2, 2019
1 parent ad1fa7d commit 13c5123
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
46 changes: 41 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,48 @@
# GitHub Pull Request Comment Build Plugin

This plugin listens for comments on pull requests and will trigger a GitHub multibranch
job if a comment body matches the configured value, such as "REBUILD". This is implemented
as a branch property on multibranch jobs.
job if a comment body matches the configured value, such as "rerun the build".
This is implemented as a branch property on multibranch jobs.

To enable this behavior, simply add one or more of the branch properties from
this plugin to the multibranch job and configure the regular expression to use.
The regex is not surrounded with any markers and uses the
`Pattern.CASE_INSENSITIVE` and `Pattern.DOTALL` Java flags.

For example, `^rerun the build$` only matches comments that contain no other
text besides "rerun the build" (case insensitive), while `rebuild` would match
comments such as

```
Please
rebuild this
```

and

```
Commence the rebuilding
```

If no pattern is provided, `^REBUILD$` is used.

![GitHub Multibranch Job Configuration](docs/branch-property-strategy.png)

Please ensure that you have a GitHub server properly connected via the Jenkins configuration,
or else the plugin will not operate correctly.

## GitHub Organization Folders

When using the GitHub organization folders approach to creating multibranch
pipeline jobs, the branch properties may not be edited [according to
design](https://issues.jenkins-ci.org/browse/JENKINS-33900?focusedCommentId=326187&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-326187).
Instead, use the functionality built into the GitHub Plugin with using the
[issueCommentTrigger](https://github.com/jenkinsci/pipeline-github-plugin#issuecommenttrigger)
in your pipeline script. This works in a similar way to this plugin. The main
advantage of this plugin is that it may be used from the Job DSL plugin to
create jobs with this branch property already added (in the case when you don't
trust pipeline scripts, etc).

To enable this behavior, simply add the branch property to the multibranch job and
configure the string to use. Make sure that you have a GitHub server properly connected
via the Jenkins configuration, or else this will not work.

# Plugin maintenance

Expand Down
Binary file added docs/branch-property-strategy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 13c5123

Please sign in to comment.