Code Monkey home page Code Monkey logo

github-pr-comment-build-plugin's Introduction

NOTE: This plugin is incompatible with version 2.177 of Jenkins. Upgrading to 2.260 solves the issue. Please see #24 for more information.

GitHub Pull Request Comment Build Plugin

Jenkins Plugin Jenkins Plugin Installs

About this 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 "rerun the build". This is implemented as a branch property on multibranch jobs.

Setup

For the plugin to work your multibranch job must use one of the "Discover pull requests from..." behaviors. For example: GitHub Multibranch PR Behavior

To enable the plugin's functionality, simply add one or more of the branch properties from this plugin to the multibranch job and configure the regular expression to match against the comment body.

GitHub Multibranch Job Configuration

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

Regular expression matching

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.

Untrusted Builds

This plugin only triggers builds from trusted users. This is an incompatible change since July 2022 releases of the plugin. If you would like untrusted users to be able to trigger builds, check the "Allow Untrusted Users" checkbox. Use this feature with caution because it may open up security issues with your Jenkins infrastructure.

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. Instead, use the functionality built into the GitHub Plugin with using the 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).

Changelog

Latest (Post September 20, 2021)

Incremental Releases

Releases starting with 58.v945be9f1661f have been moved to incremental versioning. See the release history and log on the releases page.

Older releases

2.2 (November 6, 2020)

Add GitHub comment body in the cause object when a build is triggered (thanks to @jebentier for PR #25).

2.0 (June 15, 2017)

Support newer SCM/branch source plugins. Use this release if you are using the 2.x releases of the SCM API-related plugins.

1.1 (March 6, 2017)

Add support for building a job when a PR title or body is updated as well by using a separate branch property.

1.0 (January 23, 2017)

Initial release

Plugin maintenance

Releasing new versions

Use the instructions found in the Jenkins docs for GitHub releases. The main point here is to make sure the PR that releases a new feature has the "enhancement" label on it, and this will automatically trigger a new release.

github-pr-comment-build-plugin's People

Contributors

agyaeytiwari avatar bluesliverx avatar daniel-beck-bot avatar jebentier avatar jetersen avatar lprimak avatar mloo-sp avatar ncreep avatar notmyfault avatar pascal-hofmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

github-pr-comment-build-plugin's Issues

Retrieve comment author from the plugin

I'm using the github-pr-comment-build-plugin to start a build on Jenkins on a fixed commit pattern. The catch here is that, I need only few users to trigger the build via their comment.

I can't restrict authors on Github as I want all authors to make comments on the PR but only a few authors' comments to trigger the build

The approach I'm trying to use here is by retrieving the author of the comment during the build (that was triggered by the comment), I'll abort/kill the build if the author is not part of the approved list of authors.

Is there a way I can pull the author information using this plugin?
I use Scripted Pipeline.

Thanks for your time!

Comment on PR not triggering Jenkins Job

Hello, i set up my jenkins to rebuild job on jenkins using this plugin ..
image
But i only got this log and the build didn't start at all ..
Please help, did i miss something ?

Restrict build trigger to project group members

What feature do you want to see added?

I would like only the project members to be able to trigger builds.
However, there is no way to do this with the plugin.
Anyone can make a fork / PR to the project and kick off a build with a PR comment.
Is there any way to restrict this to project members?

Thanks!

Upstream changes

No response

Comment text as env-var to job

What feature do you want to see added?

Could we provide the comment text as a environment variable to the job?

Upstream changes

No response

This plugin triggers the build twice

Version report

Jenkins and plugins versions report:

Plugin version - 2.3
Jenkins version - 2.235.1
--


<br class="Apple-interchange-newline">
  • What Operating System are you using (both controller, and any agents involved in the problem)?
Paste here

Reproduction steps

  • Step 1 - Enable pull request review webhook in github (as mentioned below)
    image

  • Step 2 - Configure build on pull request review - as shown below
    image

Results

Expected result:

it should trigger a build only once when the pr is approved.

Actual result:

its triggering the build twice everytime when the pr is approved.

How to get a comment body that triggered the job?

Hello!

First of all, thank you for the wonderful plugin, it seems the best (and it seems the only) option for MultiBranch Pipelines that need to be triggered by a comment from the pull request.

However, I can't find a way to retrieve the exact phrase that the build has been triggered with.
I've tried to use currentBuild.rawBuild.causes and I get an array with a single object [com.adobe.jenkins.github_pr_comment_build.GitHubPullRequestCommentCause@3f698a28], but I'm not sure how to proceed further, https://github.com/jenkinsci/github-pr-comment-build-plugin/blob/master/src/main/java/com/adobe/jenkins/github_pr_comment_build/GitHubPullRequestCommentCause.java doesn't seem to have any methods for retrieving the comment body, even getCommentUrl() method doesn't work. What am I doing wrong?

Ideally, it would be great to have this information already available as environment variable, similar to CHANGE_ID, CHANGE_AUTHOR and others.

Support GH organization folders

From Jesse Glick: BranchProperty will not suffice for a GH org folder I think. You would need an AbstractFolderProperty<OrganizationFolder>.

not able to retrieve getCommentBody or getCommentURL from currentBuild.buildCauses

Hey Team,

We are trying to get github comment body to trigger different stages of pipeline using "when" expression and hence need commentbody to check which comment triggered this build ..like "testpr" to run tests, "deploypr" to do deployment, etc.

We have set up a multibranch pipeline and trigger build based on comments by developer.

Pipeline script:

pipeline {
agent { label 'any' }
stages {
stage('Pre-build') {
steps {
script {
dir("${WORKSPACE}") {
script {
echo "${glance_tag}"
echo "${currentBuild.buildCauses}" // [[_class:com.adobe.jenkins.github_pr_comment_build.GitHubPullRequestCommentCause, shortDescription:GitHub pull request comment]]
def buildCauses = currentBuild.buildCauses
echo "$buildCauses.getCommentBody()" // gives null
echo "$buildCauses.getCommentUrl()" // gives null
echo "$buildCauses.shortDescription" // gives GitHub pull request comment
}
}
}
}
}
}
}

Can you please tell me - what I am doing wrong to fetch required information.

plugin doesn't trigger a build when a PR comment is issued

Jenkins and plugins versions report

Environment
Jenkins: 2.319.3
OS: Linux - 3.10.0-1160.53.1.el7.x86_64

generic-webhook-trigger:1.83
ghprb:1.36.2
git:4.10.3
git-client:3.11.0
git-server:1.10
github:1.34.2
github-api:1.301-378.v9807bd746da5
github-branch-source:2.11.4
github-pr-comment-build:61.v49f749d31d98
github-scm-trait-notification-context:1.1
.
.
.
pipeline-build-step:2.15
pipeline-github:2.8-138.d766e30bb08b
pipeline-github-lib:36.v4c01db_ca_ed16
pipeline-graph-analysis:188.v3a01e7973f2c
pipeline-input-step:446.vf27b_0b_83500e
pipeline-milestone-step:100.v60a_03cd446e1
pipeline-model-api:1.9.3
pipeline-model-definition:1.9.3
pipeline-model-extensions:1.9.3
pipeline-multibranch-defaults:2.1
pipeline-rest-api:2.21
pipeline-stage-step:291.vf0a8a7aeeb50
pipeline-stage-tags-metadata:1.9.3
pipeline-stage-view:2.21

What Operating System are you using (both controller, and any agents involved in the problem)?

RHEL 7.9

Reproduction steps

Multi-branch Job Configuration:

image

Expected Results

Multi-branch Job build should be triggered if a PR comment matching the regular expression configured is issued

Actual Results

Multi-branch job isn't getting triggered when a comment that matches the configured regular expression is issued, And here is the log,

Calling registerHooks() for test-multi-branch 
Feb 20, 2022 12:37:54 PM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run GitHub webhooks activated for job test-multi-branch with [GitHubRepositoryName[host=github.enterprise.com,username=org-name,repository=repo-name]] (events: [PULL_REQUEST, PUSH, PULL_REQUEST_REVIEW, ISSUE_COMMENT]) 
Feb 20, 2022 12:38:02 PM FINE org.jenkinsci.plugins.github.webhook.WebhookManager repoWithWebhookAccess None of the github repos configured have admin access for: GitHubRepositoryName[host=github.enterprise.com,username=org-name,repository=repo-name] 
Feb 20, 2022 12:55:59 PM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply 
Feb 20, 2022 12:57:42 PM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
Calling registerHooks() for test-org/repo-name
Feb 20, 2022 12:57:42 PM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
GitHub webhooks activated for job   test-org/repo-name with [GitHubRepositoryName[host=github.ibm.com,username=org-name,repository=repo-name]] (events: [PULL_REQUEST, PUSH, PULL_REQUEST_REVIEW, ISSUE_COMMENT])
Feb 20, 2022 12:57:43 PM FINE org.jenkinsci.plugins.github.webhook.WebhookManager repoWithWebhookAccess
None of the github repos configured have admin access for: GitHubRepositoryName[host=github.ibm.com,username=org-name,repository=repo-name]

Anything else?

No response

Please give some example pipeline code in the README

Describe your use-case which is not covered by existing documentation.

I recently came across this plugin and thought it would be a really useful way to launch different tasks via PR comments. As someone who is not intimately familiar with Jenkins pipeline scripting, it would have been really useful for me to see a short snippet of code showing how I would go about retrieving the comment body from the plugin. Especially since the correct way to retrieve build causes seems to have changed over the years. Not that I even knew that I needed to retrieve build causes when I started. I got there in the end with lots of confused Googling and many many failed builds.

To save other poor souls like me from hours of frustration, please could you put a quick example in the README?

I'm thinking something like this:

script {
  def triggerCause = currentBuild.getBuildCauses("com.adobe.jenkins.github_pr_comment_build.GitHubPullRequestCommentCause")

  if (triggerCause) {
    echo("Author: ${triggerCause.commentAuthor}, Message: " +
              "\"${triggerCause.commentBody}\"")
  } else {
    echo("Build was not started by a PR comment")
  }
}

It's quite possible that's wrong, because I (still) don't really know what I'm doing. But you probably get the idea!

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

No response

For private repositories people with Read role can trigger builds

For private repositories people with Read role (aka pull permission) are seen as collaborators by the GitHub API. This means, they are able to trigger builds.

In addition it would be great if there was a way to only trust users with admin permission. This way people with push permission could still collaborate on the same branches of a repo, but sensitive builds could only be triggered by authorized people.

Job is triggered twice with this plugin

Hi.
I am trying to use this plugin, but it triggers the job twice.
I found that SCMSourceOwner has duplicated jobs like
job/name_of_job and job/name_of_job/job/name_of_repository/
Could you fix the duplication? or could you let me know the way to avoid this situation?

can we support the addition of labels as a feature to trigger?

Given that the logic is probably very similar, can we support the PR build to occur on the addition of a label? That event is sent from GH, but I don't know of any plugins that allow the build to occur when it receives that event.

It would seem that it would be pretty similar to https://github.com/jenkinsci/github-pr-comment-build-plugin/blob/master/src/main/java/com/adobe/jenkins/github_pr_comment_build/IssueCommentGHEventSubscriber.java but just subscribing to a different event action. (created: label, I think)

I'm mentioning this here because it really does seem related, and also makes things foolproof. When users need to type a certain phrase, typos can be a fact of life. Adding one (or more) of a specific predefined label removes some of that concern, and is a great way to differentiate PRs without needing to parse all the (potentially many!) comments, etc. etc.

Version 1.2 isn't published to Jenkins Plugins

https://plugins.jenkins.io/github-pr-comment-build states that I should use version 1.2 with 2.x SCM API-related plugins. However, I couldn't find version 1.2 neither in https://updates.jenkins.io/stable-2.46/update-center.json nor in https://updates.jenkins.io/experimental/update-center.json. Could you publish it, or publish instructions how to install it?

P.S. Since change of dependencies is breaking, it makes sense to increment major version. I.e. release it as 2.0 instead of 1.2.

PR comment not triggering build

Hi,

I am trying to use this plugin in a multibranch pipeline. I have github configured and its working with webhooks on commits in PRs. But it does not seem to work for comments,

Here is my configuration for the pipeline.

image

I analysed the logs for when I save the configuration. This is what I got

Calling registerHooks() for gateway-sonar
Oct 15, 2019 11:16:16 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
GitHub webhooks activated for job gateway-sonar with [GitHubRepositoryName[host=github.com,username=xxxxx,repository=xxxxxx]] (events: [PULL_REQUEST, PUSH])
Oct 15, 2019 11:16:19 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
Replaced hook https://api.github.com/repos/xxxxxx/xxxxxxxx/hooks/149057 (events: [CREATE, DELETE, ISSUE_COMMENT, PULL_REQUEST, PULL_REQUEST_REVIEW, PULL_REQUEST_REVIEW_COMMENT, PUSH])
Oct 15, 2019 11:16:20 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
Created hook https://api.github.com/repos/xxxxxx/xxxxxx/hooks/149090 (events: [CREATE, DELETE, ISSUE_COMMENT, PULL_REQUEST, PULL_REQUEST_REVIEW, PULL_REQUEST_REVIEW_COMMENT, PUSH])

I think here in the logs it should activate the webhooks for ISSUE_COMMENT or PULL_REQUEST_REVIEW_COMMENT which it is not.

Could you please help me find what I am doing wrong?

Question - Github App Authentication - Does it work?

Hi there,

I am trying to get this plugin to work, I have jobs configured via the GitHubSCMSource in a declarative pipeline.

While testing, I have setup for it to take any comments to trigger the build via .*

As of right now, I cannot get this to work at all. I guess my main question is if this plugin supports GithubApp authentication?

Get comment content?

Is there currently a way to retrieve the content of the comment that started a Jenkins build? It would be useful to have in the case of performing different build steps based on the nature of the comment.

Allow jobs that are not named PR-.*

I have set up the plugin for a multibranch pipeline. But the pull request comments are not triggering the build.
I was checking the plugin code.

There is a regex variable pullRequestJobNamePattern=Pattern.compile("^PR-" + pullRequestId + "\\b.*$", Pattern.CASE_INSENSITIVE)

https://github.com/jenkinsci/github-pr-comment-build-plugin/blob/master/src/main/java/com/adobe/jenkins/github_pr_comment_build/IssueCommentGHEventSubscriber.java#L94

It is being used to match with the job name.
https://github.com/jenkinsci/github-pr-comment-build-plugin/blob/master/src/main/java/com/adobe/jenkins/github_pr_comment_build/IssueCommentGHEventSubscriber.java#L136

I need help in understanding why does this pattern have to be matched with the job name. As I could understand, the job name contains pipeline name and branch name concatenated by a slash (pipelineName/jobName). I debugged the code, In my case, this pattern is not being matched and hence pipeline is not being triggered.

Thanks

PR Comment doesn't trigger a new build when not using webhooks

Hi guys,

short question, does this plugin also work without webhooks configured? We use GitHub Multibranch pipeline job which periodically checks the repository, see here:

obrázok

And we have the plugin configured like this:
obrázok

But issuing a PR comment jenkins retest this doesn't trigger the build.

The version of Github Branch Source Plugin used is 2.5.4 and PR Comment Build Plugin is 2.1.

I also noticed that in documentation you have this stated:

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

Not sure what you mean by that.

Any help apprecaited!

Thanks

The plugin is not triggered with a multibranch pipeline

Version report

Jenkins and plugins versions report:

latest
  • What Operating System are you using (both controller, and any agents involved in the problem)?
N/A

Reproduction steps

  • Installed plugin and related stuff
  • Created a multibranch pipeline with webhook.
  • Used a CURL with a valid payload of a github event trigerred by a comment

Results

Expected result:

Creates a new build in the specific job for the specific pull request
Actual result:

Only trigger the scan with no logs from the plugin.

What this piece of code means? Perhaps is discarded for this reason, but I don't know what SCMSourceOwner implies.
@OverRide
protected boolean isApplicable(Item item) {
if (item != null && item instanceof Job) {
Job project = (Job) item;
if (project.getParent() instanceof SCMSourceOwner) {
SCMSourceOwner owner = (SCMSourceOwner) project.getParent();
for (SCMSource source : owner.getSCMSources()) {
if (source instanceof GitHubSCMSource) {
return true;
}
}
}
}
return false;
}

Triggerring more than one job with single PR comment is broken

Jenkins and plugins versions report

Environment
Jenkins: [CloudBees CI Managed Controller 2.346.2.3-rolling](https://release-notes.cloudbees.com/product/141)
github-pr-comment-build version: 78.v2dcf62ba199b

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux, Agents are all Kubernetes agents

Reproduction steps

  • Install 61.v49f749d31d98 version of plugin
  • Create multiple Jenkins files in the same repo
  • Create multiple branch jobs for all the jenkinsfiles created in the same repo
  • Configure all the jobs to be configured to be triggered from a PR comment
  • Create a PR and comment on the PR, All the jobs are triggered.
  • Now upgrade the plugin to new version: 78.v2dcf62ba199b
  • Comment again on the same PR, one a single job is triggerred.

Expected Results

The plugin is expected to be working as before, triggering all the jobs that are matching the criteria of jobs that are configured to be kicked of for a PR comment

Actual Results

Triggering only the first job from the list of jobs configured to run on a single PR comment

Anything else?

This is working as expected in the older version: 61.v49f749d31d98
After we have upgraded to the new version: 78.v2dcf62ba199b this functionality seems to be broken

I suspect, this is broken because of #48

Jenkins Build triggering on every Issue Comment rather on specific regex

Use Case :-
I am trying to trigger my pipeline on an issue comment with deploy on dev in body

Github Webhook -
Screenshot 2020-09-25 at 1 43 24 PM

Jenkins MultiBranch Pipeline -
image

Jenkins Shared Library-
triggers { issueCommentTrigger('deploy on dev') }

This prints Build was not started by a trigger -

if (triggerCause) { echo("Build was started by ${triggerCause.userLogin}, who wrote: " + "\"${triggerCause.comment}\", which matches the " + "\"${triggerCause.triggerPattern}\" trigger pattern.") } else { echo('Build was not started by a trigger') }

It is triggering on every Issue comment rather than searching for deploy on dev. Have tried multiple of things not sure what is wrong`

review dosent seem to work

Hi I don't see much documentation regarding the review option,

i tried to test this by adding a reviewer and having them approve but no job was triggered

The plugin triggers builds for PRs with same number in different repositories

Jenkins and plugins versions report

Environment

Jenkins: 2.346.3
OS: Linux - 4.14.326-245.539.amzn2.x86_64
Java: 11.0.16 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)

.....
branch-api:2.1071.v1a_188a_562481
git:4.14.3
git-client:3.13.1
github:1.34.5
github-api:1.303-400.v35c2d8258028
github-branch-source:1696.v3a_7603564d04
github-checks:1.0.19
github-pr-comment-build:96.v9ff13b69dd66
......

What Operating System are you using (both controller, and any agents involved in the problem)?

OS: Linux - 4.14.326-245.539.amzn2.x86_64

Reproduction steps

  1. Create Github organization with several repositories containing jenkinsfiles
  2. Either configure organization webhook or 1 repository webhook with "Issue Comments" Event
  3. Create and configure Jenkins "Organization Folder" job
  4. Open a pull request in multiple repositories, so that multiple repositories have the same PR number (e.g. pull request #1 on multiple repos)
  5. Trigger a scan in the Jenkins organization to detect and create jobs for these repositories
  6. Post a comment in one of these repositories with the keyword configured in the plugin

Expected Results

The expected result would be that a build is triggered only in the repository in which the comment was posted

Actual Results

Builds are triggered for every "repository" in Jenkins that matches the PR number which sent the Github event
image

In the image above, a comment with the expected keyword was posted on first PR in the sw-prj-repo3 repository

Anything else?

Here is a log snippet:
image

Is this the intended behavior?

isAuthorized() throws an exception when it should return false

Jenkins and plugins versions report

Environment
Paste the output here

What Operating System are you using (both controller, and any agents involved in the problem)?

doesn't matter

Reproduction steps

execute webhoow to a multi-source job

Expected Results

works

Actual Results

excetion is thrown

Anything else?

No response

Programmatic configuration

Relating to #4, is there a way to configure this plugin programmatically, as from the triggers block?

The use case is that we would like to be able to add new repositories through the automatic scan and not need any on-server manual configuration. Instead, we could place a standard Jenkinsfile in new repositories and have the trigger configured automatically when the scan finds it.

what is a "trusted" user as defined by this plugin

Describe your use-case which is not covered by existing documentation.

Is that a github thing? Does the plugin have some definition of "trusted"

Context: I just installed this, think I have it configured, but builds aren't running per my PR comment. I see a section about "untrusted" users and am not sure if my user is trusted or not (which would cause the builds to not be triggered).

https://plugins.jenkins.io/github-pr-comment-build/#plugin-content-untrusted-builds

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

No response

Unable to trigger build with wildcard in the comment body

wildcardNotWorking

Build is not getting trigerred if wildcard is mentioned in the comment body for ex - if the comment body is ^buildzip*$ and on mentioning "buildzip test env" in the PR comment won't trigger the build however if the comment body is ^buildzip$ and on mentioning "buildzip" in the PR comment will trigger the build

On removing wild card(*) build is getting trigerred and on having wildcard in the comment body build is not getting trigerred
Please help me with this issue

PR COMMENT is not triggering jenkins build

A little bit of background:

In my current project, the entire pipeline job is very time-consuming. it has Build + test. So, we decided to run the Build + Test only on specific branches. (This is achieved by "when" syntax). Also, we want to build the pipeline forcefully for a Pull request with a comment/action in the pull request. So, we ended up trying this plugin.

I have tried a few options but still not able to get the build to trigger with PR comment.

This is my Jenkins configuration:

Screenshot 2019-07-31 at 13 28 49

Does it look alright?

I have also set GitHub server in administration

Screenshot 2019-07-31 at 13 33 36

By basic questions:

  1. Will this plugin trigger build even though there is no change in the commit? In my case, I will need to run some stages default and some other stages if build is triggered by comment plugin?
  2. How can I know if the build is triggered by comment plugin?
  3. Does the config look alright? What am I missing?

Build PR every time AFTER comment

Currently we have two options to modify plugin behaviour:
a) Trigger build after specific comment
b) Trugger build after PR is updated

I would like to have option to merge those two options in a following way:
a) User comment Pull Request and Build is triggered. Then this PR is marked
b) Marked PR is then updated automatically every time commit is done

This differ from b) in a way that not every PR is updated but those ones that are previously marked by user - this allows us to remove unnecessary load as we don't want to build all active PRs

Better Support for Job DSL configuration of GitHub Organization Folder

Description

Hello! For starters, thank you for the excellent plugin! I've used it to good effect on my team's Jenkins server. I appreciate your work!

I have a comment / suggestion:
I think it would be great if this plugin offered a better way to configure this plugin through the Jobs DSL plugin for a GitHub organization style job.

Unless I'm missing something obvious, I don't see an easy way / dynamic syntax for configuring this plugin via Jobs DSL.

Workaround

Fortunately, configuring this plugin for a GitHub organization folder is still possible, albeit a little awkward, by using the configure block to manually add the XML:

organizationFolder('Org') {
	organizations {
		github {
			...
		}
	}

	// configure github-pr-comment-build-plugin
	configure { organizationFolder -> 
		def strategy = organizationFolder << strategy(class: 'jenkins.branch.DefaultBranchPropertyStrategy') {
			properties(class: 'java.util.Arrays$ArrayList') {
				a(class: 'jenkins.branch.BranchProperty-array') {
					"com.adobe.jenkins.github__pr__comment__build.TriggerPRCommentBranchProperty"(plugin :'github-pr-comment-build') {
						commentBody('.*Do: Build.*')
					}
				}
			}
		}
	}

}

Not as nice as first class support, but better than nothing :)

Feature: Build on PR reviews

Would you be open to adding a feature to initiate a build on a pull request review event?

Also, are you accepting pull requests?

Trigger more than one job with single PR comment

Jenkins and plugins versions report

Hello,
I would like to ask a question if your plugin parses further jobs to run if it finds a match? I have a case where I have two separate jobs which I want to trigger with the same PR comment, but logs show it runs only the first match and does not analyze the rest of them. Is this behavior created by design or this is a bug? I am using Jenkins in ver. 2.332.1, GitHub enterprise server 3.3.7 and GitHub PR Comment Build Version: 78.v2dcf62ba199b.

What Operating System are you using (both controller, and any agents involved in the problem)?

RHEL 8.5 (Ootpa)

Reproduction steps

  1. Step: Clone job which you can trigger by PR comment (i.e. run forest).
  2. Step: Try to trigger those jobs by comment.

Expected Results

Run n-jobs triggered by the same comment

Actual Results

Run first match

Anything else?

No response

Thumbs up/down on successful/failed submission

What feature do you want to see added?

When a build is successfully triggered following a supported event, add a thumbs up 👍 emoji to the triggering comment.
When a build was not triggered for some reason, add a thumbs down 👎 emoji to the triggering comment.

Example of how I use custom bots and this plugin:

image

Upstream changes

No response

Document the requirement for branch discovery behavior

Describe your use-case which is not covered by existing documentation.

Hi,

As I was trying to set up the PR comment plugin on my Jenkins setup, I stumbled on the fact that (somewhat related to #20) I didn't get any triggers because I didn't use a "Discover pull request ..." behavior for my project. Instead I was using "Discover branches".

Since it seemed non-obvious to me that there was a hard requirement on the discovery behavior, I think it would be worthwhile to document this in the README file, and maybe add some more logs in that area.

Will you be open to a pull request documenting/logging this fact?

Thanks

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.