Undesired Rerun of opened pull request
Hi
All already opened pull request are triggered that were already triggered in the past. This is happened multiple times and I don't see any bugs in logs
Check what reason is in attached polling log
BUILD_CAUSE : GITHUBPRCAUSE,GITHUBPRCAUSE,GITHUBPRCAUSE,GITHUBPRCAUSE,GITHUBPRCAUSE,GITHUBPRCAUSE,GITHUBPRCAUSE,GITHUBPRCAUSE,GITHUBPRCAUSE,GITHUBPRCAUSE,GITHUBPRCAUSE,GITHUBPRCAUSE,GITHUBPRCAUSE
Polling log Running GitHub Pull Request trigger check for Mar 20, 2017 11:11:48 PM on GitHubRepositoryName[host=github.com,username=carwale,repository=carwaleweb] GitHub rate limit before check: GHRateLimit{remaining=4579, limit=5000, resetDate=Tue Mar 21 00:03:51 IST 2017} Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened) Pull Request Opened: state has changed (PR was opened)
so all the opened pull request start building
any updates on it ?
Looks strange, have no idea now. Do you have something in global log? Does the same happens if you create new empty job?
We have hit this as well. No changes were occurring to configurations or anything else that should change the triggering pattern, and then all open PRs tried to trigger, Looking to even ignore ancestry logic for the buildchooser class.
@KostyaSha - We had this happen again yesterday. I've gone back through our main Jenkins.Log and pulled out the last few minutes before the mass run kicked off. (7:04:51am is when everything kicked off)
INFO: GitHub rate limit after check GitHubRepositoryName[host=github.com,username=udemy,repository=website-django]: GHRateLimit{remaining=3917, limit=5000, resetDate=Fri May 05 07:37:53 PDT 2017}, consumed: 3, checked PRs: 154
May 05, 2017 7:00:02 AM org.jenkinsci.plugins.github.pullrequest.utils.LoggingTaskListenerWrapper info
INFO: Finished GitHub Pull Request trigger check for GitHubRepositoryName[host=github.com,username=udemy,repository=website-django] at May 5, 2017 7:00:02 AM. Duration: 61282ms
May 05, 2017 7:00:11 AM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
INFO: Received PushEvent for https://github.com/udemy/website-django from 192.30.252.41 → 104.156.90.30 → 192.30.252.41 ⇒ https://<scrubbing internal url>/github-webhook/
May 05, 2017 7:00:11 AM org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger readyToBuildCauses
INFO: GitHub rate limit after check GitHubRepositoryName[host=github.com,username=udemy,repository=website-django]: GHRateLimit{remaining=3913, limit=5000, resetDate=Fri May 05 07:37:53 PDT 2017}, consumed: 0, checked PRs: 1
May 05, 2017 7:00:11 AM org.jenkinsci.plugins.github.pullrequest.utils.LoggingTaskListenerWrapper info
INFO: Finished GitHub Pull Request trigger check for GitHubRepositoryName[host=github.com,username=udemy,repository=website-django] at May 5, 2017 7:00:11 AM. Duration: 122ms
May 05, 2017 7:00:48 AM org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger readyToBuildCauses
INFO: GitHub rate limit after check GitHubRepositoryName[host=github.com,username=udemy,repository=website-django]: GHRateLimit{remaining=3796, limit=5000, resetDate=Fri May 05 07:37:53 PDT 2017}, consumed: 121, checked PRs: 154
May 05, 2017 7:00:48 AM org.jenkinsci.plugins.github.pullrequest.utils.LoggingTaskListenerWrapper info
INFO: Finished GitHub Pull Request trigger check for GitHubRepositoryName[host=github.com,username=udemy,repository=website-django] at May 5, 2017 7:00:48 AM. Duration: 46795ms
May 05, 2017 7:01:10 AM org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger readyToBuildCauses
INFO: GitHub rate limit after check GitHubRepositoryName[host=github.com,username=udemy,repository=website-django]: GHRateLimit{remaining=3758, limit=5000, resetDate=Fri May 05 07:37:53 PDT 2017}, consumed: 35, checked PRs: 154
May 05, 2017 7:01:10 AM org.jenkinsci.plugins.github.pullrequest.utils.LoggingTaskListenerWrapper info
INFO: Finished GitHub Pull Request trigger check for GitHubRepositoryName[host=github.com,username=udemy,repository=website-django] at May 5, 2017 7:01:10 AM. Duration: 9385ms
May 05, 2017 7:01:42 AM org.jenkinsci.plugins.workflow.job.WorkflowRun finish
INFO: WD_Build_Artifact #9643 completed: FAILURE
May 05, 2017 7:02:03 AM org.jenkinsci.plugins.github.pullrequest.trigger.check.NotUpdatedPRFilter isUpdated
INFO: Pull request #16999 was created by duyguaral, last updated: Fri May 05 05:26:34 PDT 2017
May 05, 2017 7:02:50 AM org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger readyToBuildCauses
INFO: GitHub rate limit after check GitHubRepositoryName[host=github.com,username=udemy,repository=website-django]: GHRateLimit{remaining=3721, limit=5000, resetDate=Fri May 05 07:37:53 PDT 2017}, consumed: 33, checked PRs: 154
May 05, 2017 7:02:50 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause apply
INFO: Jenkins queued the run (Commit changed)
May 05, 2017 7:02:50 AM org.jenkinsci.plugins.github.pullrequest.utils.LoggingTaskListenerWrapper info
INFO: Finished GitHub Pull Request trigger check for GitHubRepositoryName[host=github.com,username=udemy,repository=website-django] at May 5, 2017 7:02:50 AM. Duration: 49385ms
May 05, 2017 7:03:00 AM org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger readyToBuildCauses
INFO: GitHub rate limit after check GitHubRepositoryName[host=github.com,username=udemy,repository=website-django]: GHRateLimit{remaining=3720, limit=5000, resetDate=Fri May 05 07:37:53 PDT 2017}, consumed: 0, checked PRs: 154
May 05, 2017 7:03:01 AM org.jenkinsci.plugins.github.pullrequest.utils.LoggingTaskListenerWrapper info
INFO: Finished GitHub Pull Request trigger check for GitHubRepositoryName[host=github.com,username=udemy,repository=website-django] at May 5, 2017 7:03:01 AM. Duration: 266ms
May 05, 2017 7:04:17 AM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
INFO: Received PushEvent for https://github.com/udemy/website-django from 192.30.252.42 → 104.156.90.29 → 192.30.252.42 ⇒ https://<scrubbing internal url>/github-webhook/
May 05, 2017 7:04:17 AM org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger readyToBuildCauses
INFO: GitHub rate limit after check GitHubRepositoryName[host=github.com,username=udemy,repository=website-django]: GHRateLimit{remaining=3712, limit=5000, resetDate=Fri May 05 07:37:53 PDT 2017}, consumed: 0, checked PRs: 1
May 05, 2017 7:04:17 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause apply
INFO: Jenkins queued the run (PR opened)
May 05, 2017 7:04:17 AM org.jenkinsci.plugins.github.pullrequest.utils.LoggingTaskListenerWrapper info
INFO: Finished GitHub Pull Request trigger check for GitHubRepositoryName[host=github.com,username=udemy,repository=website-django] at May 5, 2017 7:04:17 AM. Duration: 107ms
May 05, 2017 7:04:51 AM hudson.model.AsyncPeriodicWork$1 run
INFO: Started EC2 alive slaves monitor
May 05, 2017 7:04:51 AM hudson.model.AsyncPeriodicWork$1 run
INFO: Finished EC2 alive slaves monitor. 0 ms
May 05, 2017 7:04:51 AM org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger readyToBuildCauses
INFO: GitHub rate limit after check GitHubRepositoryName[host=github.com,username=udemy,repository=website-django]: GHRateLimit{remaining=3583, limit=5000, resetDate=Fri May 05 07:37:53 PDT 2017}, consumed: 136, checked PRs: 154
May 05, 2017 7:04:51 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause apply
INFO: Jenkins queued the run (PR opened)
May 05, 2017 7:04:51 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause apply
INFO: Jenkins queued the run (PR opened)
May 05, 2017 7:04:51 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause apply
INFO: Jenkins queued the run (PR opened)
May 05, 2017 7:04:51 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause abortRunning
INFO: Aborting 'WD_Build_Artifact #9647', by interrupting 'Thread[Executor #-1 for master : executing WD_Build_Artifact #9647,5,]'
May 05, 2017 7:04:51 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause apply
INFO: Jenkins queued the run (PR opened). 1 running builds/runs aborted.
May 05, 2017 7:04:51 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause apply
INFO: Jenkins queued the run (PR opened)
Any thoughts or recommendations?
What is in polling log attached to kicked build?
Also please post your config.xml
What jenkins, plugins versions used?
@KostyaSha
polling log was squashed by freakout recovery (all problem builds that were kicked off were deleted, so lost all individual polling logs for those runs)
Jenkins ver: 2.7.4 Plugin: 0.1.0-rc22
Config attached, sanitized as required.
Happened again today @KostyaSha
Jenkins.Log
May 08, 2017 5:04:43 AM org.jenkinsci.plugins.github.pullrequest.utils.LoggingTaskListenerWrapper info
INFO: Finished GitHub Pull Request trigger check for <sanitized> at May 8, 2017 5:04:43 AM. Duration: 43363ms
May 08, 2017 5:05:00 AM org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger readyToBuildCauses
INFO: GitHub rate limit after check <sanitized>: GHRateLimit{remaining=3403, limit=5000, resetDate=Mon May 08 05:38:27 PDT 2017}, consumed: 0, checked PRs: 147
May 08, 2017 5:05:00 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause abortRunning
INFO: Aborting 'WD_Build_Artifact #9988', by interrupting 'Thread[Executor #-1 for master : executing WD_Build_Artifact #9988,5,]'
May 08, 2017 5:05:00 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause apply
INFO: Jenkins queued the run (PR opened). 1 running builds/runs aborted.
May 08, 2017 5:05:00 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause abortRunning
INFO: Aborting 'WD_Build_Artifact #9989', by interrupting 'Thread[Executor #-1 for master : executing WD_Build_Artifact #9989,5,]'
May 08, 2017 5:05:00 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause apply
INFO: Jenkins queued the run (PR opened). 1 running builds/runs aborted.
May 08, 2017 5:05:00 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause apply
INFO: Jenkins queued the run (PR opened)
May 08, 2017 5:05:00 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause apply
INFO: Jenkins queued the run (PR opened)
<repeats for all 147 open PRs>
Polling Logs
Build Number 9988
Running GitHub Pull Request trigger check for May 8, 2017 4:51:45 AM on <sanitized>
GitHub rate limit before check: GHRateLimit{remaining=4062, limit=5000, resetDate=Mon May 08 05:38:27 PDT 2017}
Pull Request Opened: state has changed (PR was opened)
Build Number 9989
Running GitHub Pull Request trigger check for May 8, 2017 4:55:00 AM on <sanitized>
GitHub rate limit before check: GHRateLimit{remaining=3794, limit=5000, resetDate=Mon May 08 05:38:27 PDT 2017}
PR <PR details> [not changed] (145+ rows of the same)
GitHubPRCommitEvent: new commit found, sha b8fe7ae7644c945aed109e6f231e09c5c5a923bd
Build Number 9990
Running GitHub Pull Request trigger check for May 8, 2017 4:58:39 AM on <sanitized>
GitHub rate limit before check: GHRateLimit{remaining=3634, limit=5000, resetDate=Mon May 08 05:38:27 PDT 2017}
GitHubPRCommitEvent: new commit found, sha 064f4c01d24ed141531e20e736c7a7e362a1fd88
Build Number 9991-10137
Running GitHub Pull Request trigger check for May 8, 2017 5:05:00 AM on <sanitized>
GitHub rate limit before check: GHRateLimit{remaining=3403, limit=5000, resetDate=Mon May 08 05:38:27 PDT 2017}
Pull Request Opened: state has changed (PR was opened)
Pull Request Opened: state has changed (PR was opened)
<repeats Pull Request Opened: for all 147 open PRs, for all 147 generated builds>
Could you PM? Can i get somehow access to this instance or check with you in more robust manner? I'm available in gitter.im
Could you also disable cache in jenkins global settings for github connector?
So could you guys firstly check that
-
org.jenkinsci.plugins.github.pullrequest.GitHubPRRepository.runtime.xmlexists and has content - "GitHub PR" page contains all PRs and shows data - latest hashes and etc.
- I guess on this page when you press run trigger it kicks builds for every trigger run? That all looks like local repository dissappeaars. If 3 really repeats builds, then could you open job configuration and then save (without doing any changes) and press "Run GH PR trigger" again.
@KostyaSha thanks for the updates:
- I've disabled the github cache
- I can find org.jenkinsci.plugins.github.pullrequest.GitHubPRRepository.xml but not org.jenkinsci.plugins.github.pullrequest.GitHubPRRepository.runtime.xml
- The GitHub PR page looks correct.
What do you mean by local repository disappears, specifically from the Jenkins Master?
Thanks again for the assistance!
Scott
This annoying issue happens here as well, about once a day (but seen also 3 times during few hours), all open buildable PRs get triggered. Unbuildable ones are skipped correctly based on trigger policy. I see no related/meaningful events on GH side (no PR changes), nor on Jenkins side logged prior to fake triggers.
Versions now: Jenkins LTS 2.46.2 gtihub-pullrequest: 0.1.0-rc24
This did not happen on previous level of versions we used: Jenkins LTS 2.32.2 gtihub-pullrequest: 0.1.0-rc12
The trigger reason is always "PR opened", which is not true. I already tried to turn GH PR cache off/on, has no effect.
Sample from master log: May 24, 2017 12:42:12 AM org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger readyToBuildCauses INFO: GitHub rate limit after check GitHubRepositoryName[host=github.com]: GHRateLimit{remaining=4998, limit=5000, resetDate=Wed May 24 01:33:08 PDT 2017}, consumed: 0, checked PRs: 16 May 24, 2017 12:42:12 AM org.jenkinsci.plugins.github.pullrequest.trigger.JobRunnerForCause apply INFO: Jenkins queued the run (PR opened)
, consumed: 0, checked PRs: 16 that mean that you have cache enabled. Please disable it. Trigger by some reason see something new and triggers. I will make PR with more logging enabled.
Unfortunately I cannot disable the Cache in our environment. I tried this approach and within 15 minutes was hitting Github API rate limits.
Cheers,
Scott Estes Udemy.Com
On Wed, May 24, 2017 at 9:53 AM, Kanstantsin Shautsou < [email protected]> wrote:
, consumed: 0, checked PRs: 16 that mean that you have cache enabled. Please disable it. Trigger by some reason see something new and triggers. I will make PR with more logging enabled.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/KostyaSha/github-integration-plugin/issues/203#issuecomment-303660985, or mute the thread https://github.com/notifications/unsubscribe-auth/AVH6Al4vabl27T1rOXHI1O_qc57249ZPks5r8-_4gaJpZM4Mdhcd .
@scott-estes strange, How much jobs do you have?
I can find org.jenkinsci.plugins.github.pullrequest.GitHubPRRepository.xml but not org.jenkinsci.plugins.github.pullrequest.GitHubPRRepository.runtime.xml
The right is .runtime.xml i will provide script for debugging.
I don't see the .runtime.xml file at all then, is it possibly only generated with a Freestyle job and not pipeline?
The Pull Request Plugin is only associated with one job, and is the only one that does polling. However we have around 160 feature branches at any given time against this one repo.
Pipeline code is as follows:
checkout([$class: 'GitSCM', branches: [[name:
'origin-pull/pull/${GITHUB_PR_NUMBER}/merge']],
doGenerateSubmoduleConfigurations: false, extensions: [[$class:
'CleanBeforeCheckout'], [$class: 'CleanCheckout'], [$class:
'BuildChooserSetting', buildChooser: [$class: 'AncestryBuildChooser',
ancestorCommitSha1: 'bbdb707f965ff5cc741befce9b4c2dd57c38926e',
maximumAgeInDays: 3]]], submoduleCfg: [], userRemoteConfigs:
[[credentialsId: '399eb9af-ab2d-4bf6-8e12-9ef9007d93b0', name: 'origin-pull',
refspec:
'+refs/pull/${GITHUB_PR_NUMBER}/merge:refs/remotes/origin-pull/pull/${GITHUB_PR_NUMBER}/merge',
url: '
Cheers,
Scott Estes Udemy.Com
On Wed, May 24, 2017 at 10:34 AM, Kanstantsin Shautsou < [email protected]> wrote:
I can find org.jenkinsci.plugins.github.pullrequest.GitHubPRRepository.xml but not org.jenkinsci.plugins.github.pullrequest. GitHubPRRepository.runtime.xml
The right is .runtime.xml
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/KostyaSha/github-integration-plugin/issues/203#issuecomment-303671019, or mute the thread https://github.com/notifications/unsubscribe-auth/AVH6AvJm-HOpHlWwT94KfmSo9XIo0s50ks5r8_mjgaJpZM4Mdhcd .
please run in script console
import static org.jenkinsci.plugins.github.pullrequest.utils.JobHelper.ghPRTriggerFromJob
import static com.github.kostyasha.github.integration.branch.utils.JobHelper.ghBranchTriggerFromJob
import org.jenkinsci.plugins.github.pullrequest.*
import com.github.kostyasha.github.integration.branch.GitHubBranchTrigger
import org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger
def job = Jenkins.instance.getItemByFullName("YOUR JOB")
GitHubPRTrigger prTrigger = ghPRTriggerFromJob(job)
println("checking for remote connection")
println(prTrigger.getRemoteRepository())
println("trigger project actions")
println(prTrigger.getProjectActions())
println(prTrigger.getRepoFullName())
def repo = job.getAction(GitHubPRRepository.class)
println("> pr repository")
println(repo)
println(repo.getConfigFile())
What is the expected format of 'def job = Jenkins.instance.getItem(" test-pr")'
Cheers,
Scott Estes Udemy.Com
On Wed, May 24, 2017 at 10:44 AM, Kanstantsin Shautsou < [email protected]> wrote:
please run in script console
import static org.jenkinsci.plugins.github.pullrequest.utils.JobHelper.ghPRTriggerFromJob import static com.github.kostyasha.github.integration.branch.utils.JobHelper.ghBranchTriggerFromJob
import org.jenkinsci.plugins.github.pullrequest.* import com.github.kostyasha.github.integration.branch.GitHubBranchTrigger import org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger
def job = Jenkins.instance.getItem("test-pr")
GitHubPRTrigger prTrigger = ghPRTriggerFromJob(job) println("checking for remote connection") println(prTrigger.getRemoteRepository()) println("trigger project actions") println(prTrigger.getProjectActions()) println(prTrigger.getRepoFullName())
def repo = job.getAction(GitHubPRRepository.class) println("> pr repository") println(repo) println(repo.getConfigFile())
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/KostyaSha/github-integration-plugin/issues/203#issuecomment-303673232, or mute the thread https://github.com/notifications/unsubscribe-auth/AVH6AhsP6Bkj0yl1wfKUHrTdqpB5d4svks5r8_vlgaJpZM4Mdhcd .
I don't see the .runtime.xml file at all then, is it possibly only generated with a Freestyle job and not pipeline?
With any job type. On local <flow-definition plugin="[email protected]"> i see correct file.
@cw-deenbandhu what job type do you use?
What is the expected format of 'def job = Jenkins.instance.getItem(" test-pr")'
where test-pr is your full path to job, see i updated script.
checking for remote connection
GHRepository@22e58a7f[description=Python/Django implementation of the
website.,homepage=<our_url>,name=<our_repo>,license=<null>,fork=false,size=360237,milestones={},language=Python,commits={},source=<null>,parent=<null>,url=https://api.github.com/repos/<ourrepopath>,id=16362580]
trigger project actions
[org.jenkinsci.plugins.github.pullrequest.GitHubPRPollingLogAction@48242509,
com.github.kostyasha.github.integration.generic.errors.GitHubErrorsAction@684016d5]
GitHubRepositoryName[host=github.com,username=<user>,repository=<ourrepo>]
pr repository
org.jenkinsci.plugins.github.pullrequest.GitHubPRRepository@6cc63a86
/var/lib/jenkins/jobs/WD_Build_Artifact/org.jenkinsci.plugins.github.pullrequest.GitHubPRRepository.runtime.xml
Email replies do not support Markdown
Better post in github, email messing layout.
/var/lib/jenkins/jobs/WD_Build_Artifact/org.jenkinsci.plugins.github.pullrequest.GitHubPRRepository.runtime.xml
Do you have this file? On what OS master is running?
yes, the file exists now.
OS is Centos 7
import org.jenkinsci.plugins.github.pullrequest.events.impl.GitHubPROpenEvent
import org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger
import com.github.kostyasha.github.integration.generic.utils.RetryableGitHubOperation
import com.google.common.collect.ImmutableSet
import org.kohsuke.github.GHIssueState
import org.kohsuke.github.GHPullRequest
import hudson.util.NullStream
import hudson.util.StreamTaskListener
import static com.github.kostyasha.github.integration.generic.utils.RetryableGitHubOperation.execute
import static com.google.common.base.Predicates.not
import static com.google.common.base.Predicates.notNull
import static org.jenkinsci.plugins.github.pullrequest.utils.PRHelperFunctions.extractPRNumber
import static org.jenkinsci.plugins.github.pullrequest.utils.PRHelperFunctions.fetchRemotePR
import static org.jenkinsci.plugins.github.util.FluentIterableWrapper.from
import static org.jenkinsci.plugins.github.util.FluentIterableWrapper.from
import com.google.common.base.Predicates
import static org.jenkinsci.plugins.github.pullrequest.utils.JobHelper.ghPRTriggerFromJob
import static com.github.kostyasha.github.integration.branch.utils.JobHelper.ghBranchTriggerFromJob
import org.jenkinsci.plugins.github.pullrequest.*
import com.github.kostyasha.github.integration.branch.GitHubBranchTrigger
import org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger
def job = Jenkins.instance.getItemByFullName("YOUR JOB")
GitHubPRTrigger prTrigger = ghPRTriggerFromJob(job)
println("checking for remote connection")
def remoteRepo = prTrigger.getRemoteRepository()
println(remoteRepo)
println("trigger project actions")
println(prTrigger.getProjectActions())
println(prTrigger.getRepoFullName())
def localRepo = job.getAction(GitHubPRRepository.class)
println("> pr repository")
println(localRepo)
println(localRepo.getConfigFile())
List<GHPullRequest> remotePulls = execute(new RetryableGitHubOperation.GitOperation<List<GHPullRequest>>() {
@Override
List<GHPullRequest> execute() throws IOException {
return remoteRepo.getPullRequests(GHIssueState.OPEN)
}
});
println(">>>remote pulls" + remotePulls)
Set<Integer> remotePRNums = from(remotePulls).transform(extractPRNumber()).toSet();
println(">>>Fetched remote PRs: " + remotePRNums);
def remotePRs = from(localRepo.getPulls().keySet())
// add PRs that was closed on remote
.filter(not(Predicates.in(remotePRNums)))
.transform(fetchRemotePR(remoteRepo))
.filter(notNull())
.append(remotePulls)
.toSet();
def event = new GitHubPROpenEvent();
remotePRs.each { pr ->
def listener = StreamTaskListener.fromStdout()
println("Checking: #" + pr.getNumber())
println(event.check(prTrigger, pr, localRepo.getPulls().get(pr.getNumber()), listener))
}
println ""
Here is end of script output on our system:
Fetched remote PRs: [163, 162, 161, 152, 147, 145, 143, 135, 122, 119, 113, 109, 50, 49, 40, 13] Checking: #163 null <.... this repeats for all PR numbers>