Jenkins won't trigger build after merging a pull request in GitHub

11,132

Solution 1

I had to create two different items. One for pull request builder and another for pull request merger.

Whole example/answer is here: Setup GitHub and Jenkins integration for pull request builder and merger

The difference is explained under bullet point 13 and 14. 14. Configure Jenkins project - Nation-Merge is the one solved my problem.

  • Refspec is blank.
  • Type origin/develop in "Branch Specifier" field.
  • Tick "GitHub hook trigger for GITScm polling" option.

Solution 2

Merge should be part of a regular push changed request and might not be handled by Pull Request Builder plugin but rather standard github plugin (as it is not a pull request anymore).

I don't know what type of job you are using (pipeline, DSL, ...), but ...

From your logs, I can tell that you have different branches where you push changes on merge, they are "develop" and "feature" while in branch specifier you have origin/master, so it will ignore changes to any of the other branches.

Share:
11,132
BentCoder
Author by

BentCoder

Updated on June 09, 2022

Comments

  • BentCoder
    BentCoder almost 2 years

    So far triggering a build in Jenkins work's fine for creating a new pull request, pushing changes and leaving a comment like test this please however, when I hit green "Merge pull request" button in GitHub, I don't see any jobs running in Jenkins.

    MY JOB SETTINGS

    Refspec: +refs/pull/*:refs/remotes/origin/pr/*

    Branch Specifier: origin/master or ${sha1}

    Took [GitHub pull request builder plugin documentation][1] as reference.

    JENKINS LOGS

    Jan 14, 2017 10:50:17 PM org.jenkinsci.plugins.ghprb.GhprbRootAction handleAction
    INFO: Checking PR #3 for Username/project
    Jan 14, 2017 10:50:17 PM org.jenkinsci.plugins.ghprb.GhprbTrigger handlePR
    INFO: Checking PR #3 for job Nation
    Jan 14, 2017 10:50:17 PM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
    INFO: Received PushEvent for https://github.com/Username/project
    Jan 14, 2017 10:50:17 PM org.jenkinsci.plugins.ghprb.GhprbRootAction handleAction
    WARNING: Request not known for event: push
    
    Jan 14, 2017 10:50:28 PM org.jenkinsci.plugins.ghprb.GhprbRootAction handleAction
    WARNING: Request not known for event: push
    Jan 14, 2017 10:50:28 PM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
    INFO: Received PushEvent for https://github.com/Username/project
    

    GITHUB WEBHOOK LOGS

    Log 1) Request X-GitHub-Event: pull_request Payload .... "action": "closed" ...

    Log 2) Request X-GitHub-Event: push Payload .... "ref": "refs/heads/develop" ...

    Log 3) Request X-GitHub-Event: push Payload .... "ref": "refs/heads/feature/update-gitignore" ...


    UPDATE

    I have Pull request, Issue comment and Push events are enabled in GitHub Webhook Setting page.

  • BentCoder
    BentCoder over 7 years
    I have "GitHub plugin" installed and used ${sha1} for Branch Specifier but no luck.
  • whitediver
    whitediver over 7 years
    Hmm that`s strange. Pull builds should disabled and branch build should start. Could your show settings screen?
  • BentCoder
    BentCoder over 7 years
    Please see images above.
  • whitediver
    whitediver over 7 years
    Fine! This is two different process build on pull request and build in branch change. We create two different builds and check "request scm on changes" or something like this