Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38447

Bitbucket hooks don't work for Pipeline jobs

    XMLWordPrintable

Details

    Description

      I’ve created a Jenkins Pipeline and now I want to run it automatically once Bitbucket receives a new push to master. Problem is that the Bitbucket webhook works fine for a regular freestyle build, but not for a Pipeline job with a Pipeline script from SCM.

      The logs in Bitbucket show that the request succeeded (returns http 200), but in Jenkins I don’t see anything happen, also not in the bitbucket hook log. The Bitbucket hook log in jenkins says ‘Polling has not run yet.’ for a pipeline job, no matter how often scm requests were made. For a freestyle job the hooks work instantly, so it seems to be a problem with the particular Jenkins job type.

      Attachments

        Issue Links

          Activity

            sc_rsc Stefan Cordes added a comment -

            The above workaround is valid for existing branches in a multibranch project.

            For new branches the Bitbucket trigger still fails.

            For that reason I investigated a little bit and found out that the Bitbucket trigger is just checking for instanceof BitBucketTrigger

            but the MultiBranch Pipeline is not a BitBucketTrigger but a SCMSourceOwner

            So I modified the BitbucketJobProbe to consider jenkins.scm.api.SCMSourceOwner:

            https://github.com/jenkinsci/bitbucket-plugin/pull/68

            (With that pull request the above "existing branch" Workaround: [$class: 'com.cloudbees.jenkins.plugins.BitBucketTrigger'] (or ,bitbucketPush()) can be removed again)

            Can someone merge it, please?

            sc_rsc Stefan Cordes added a comment - The above workaround is valid for existing branches in a multibranch project. For new branches the Bitbucket trigger still fails. For that reason I investigated a little bit and found out that the Bitbucket trigger is just checking for  instanceof BitBucketTrigger but the MultiBranch Pipeline is not a BitBucketTrigger but a  SCMSourceOwner So I modified the BitbucketJobProbe to consider jenkins.scm.api.SCMSourceOwner: https://github.com/jenkinsci/bitbucket-plugin/pull/68 (With that pull request the above "existing branch" Workaround: [$class: 'com.cloudbees.jenkins.plugins.BitBucketTrigger'] (or ,bitbucketPush() ) can be removed again) Can someone merge it, please?

            To work around this problem you can also just use this plugin: 

            Multibranch Scan Webhook Trigger
            https://plugins.jenkins.io/multibranch-scan-webhook-trigger/

             

            miike Michael Kaiser added a comment - To work around this problem you can also just use this plugin:  Multibranch Scan Webhook Trigger https://plugins.jenkins.io/multibranch-scan-webhook-trigger/  
            sc_rsc Stefan Cordes added a comment -

            Additional multibranch-scan-webhook-trigger will require a second webhook to be configured in each Repository (and [at least on our company] whitelisted in the network infrastructure).
            When finally fixed the second webhook needs to be removed from all Bitbucket repos again.

            So the more ease solution is to fix it with https://github.com/jenkinsci/bitbucket-plugin/pull/68

            sc_rsc Stefan Cordes added a comment - Additional multibranch-scan-webhook-trigger will require a second webhook to be configured in each Repository (and [at least on our company]  whitelisted in the network infrastructure). When finally fixed the second webhook needs to be removed from all Bitbucket repos again. So the more ease solution is to fix it with  https://github.com/jenkinsci/bitbucket-plugin/pull/68
            tzach_solomon Tzach Solomon added a comment -

            sc_rsc I'm the new owner of this plugin, can you please see my comment 

            https://github.com/jenkinsci/bitbucket-plugin/pull/68#issuecomment-670960506?

            tzach_solomon Tzach Solomon added a comment - sc_rsc I'm the new owner of this plugin, can you please see my comment  https://github.com/jenkinsci/bitbucket-plugin/pull/68#issuecomment-670960506?
            sc_rsc Stefan Cordes added a comment - Hello Tzach, I merged my change to your head: https://github.com/jenkinsci/bitbucket-plugin/pull/68#issuecomment-672297729  

            People

              Unassigned Unassigned
              jorrith Jorrith Schaap
              Votes:
              43 Vote for this issue
              Watchers:
              52 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: