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

Bitbucket hooks don't work for Pipeline jobs

    XMLWordPrintable

    Details

    • Similar Issues:

      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

            Hide
            omerh omer haim added a comment - - edited

            I am using Bitbucket organization, and trying to automatically trigger a build for a multi branch pipeline.

            The hook arrives to jenkins but doesnt trigger the job.

             

            Jenkins log:

             

             
            INFO: Received commit hook notification for {"scm":"git","website":"","name":"test-repo","links":{"self":
            {"href":"https://api.bitbucket.org/2.0/repositories/omerh/test-repo"}
            ,"html":{"href":"https://bitbucket.org/omerh/test-repo"},"avatar":{"href":"https://bytebucket.org/ravatar/%7B8c189537-3a35-430a-a5e1-26ab25cb16f8%7D?ts=java"}},"project":{"key":"BAC","type":"project","uuid":"
            {9359e998-bf48-4adf-9924-356ccdd06686}
            ","links":{"self":
            {"href":"https://api.bitbucket.org/2.0/teams/omerh/projects/BAC"}
            ,"html":{"href":"https://bitbucket.org/account/user/omerh/projects/BAC"},"avatar":{"href":"https://bitbucket.org/account/user/omerh/projects/BAC/avatar/32"}},"name":"Backend"},"full_name":"omerh/test-repo","owner":{"username":"omerh","display_name":"minerva-prime","type":"team","uuid":"
            {4e4e35b7-b1ce-4a47-8286-7789660275ab}
            ","links":{"self":
            {"href":"https://api.bitbucket.org/2.0/teams/omerh"}
            ,"html":{"href":"https://bitbucket.org/omerh/"},"avatar":{"href":"https://bitbucket.org/account/omerh/avatar/"}}},"type":"repository","is_private":true,"uuid":"{8c189537-3a35-430a-a5e1-26ab25cb16f8}"}
            

             

             

            This bug is couple of years old!, can someone post a workaround or a fix?

            Show
            omerh omer haim added a comment - - edited I am using Bitbucket organization, and trying to automatically trigger a build for a multi branch pipeline. The hook arrives to jenkins but doesnt trigger the job.   Jenkins log:     INFO: Received commit hook notification for { "scm" : "git" , "website" : ""," name ":" test-repo "," links ":{" self": { "href" : "https: //api.bitbucket.org/2.0/repositories/omerh/test-repo" } , "html" :{ "href" : "https: //bitbucket.org/omerh/test-repo" }, "avatar" :{ "href" : "https://bytebucket.org/ravatar/%7B8c189537-3a35-430a-a5e1-26ab25cb16f8%7D?ts=java" }}, "project" :{ "key" : "BAC" , "type" : "project" , "uuid" :" {9359e998-bf48-4adf-9924-356ccdd06686} "," links ":{" self": { "href" : "https: //api.bitbucket.org/2.0/teams/omerh/projects/BAC" } , "html" :{ "href" : "https: //bitbucket.org/account/user/omerh/projects/BAC" }, "avatar" :{ "href" : "https://bitbucket.org/account/user/omerh/projects/BAC/avatar/32" }}, "name" : "Backend" }, "full_name" : "omerh/test-repo" , "owner" :{ "username" : "omerh" , "display_name" : "minerva-prime" , "type" : "team" , "uuid" :" {4e4e35b7-b1ce-4a47-8286-7789660275ab} "," links ":{" self": { "href" : "https: //api.bitbucket.org/2.0/teams/omerh" } , "html" :{ "href" : "https: //bitbucket.org/omerh/" }, "avatar" :{ "href" : "https://bitbucket.org/account/omerh/avatar/" }}}, "type" : "repository" , "is_private" : true , "uuid" : "{8c189537-3a35-430a-a5e1-26ab25cb16f8}" }     This bug is couple of years old!, can someone post a workaround or a fix?
            Hide
            diogodias Diogo Dias added a comment -

            Hi ,

             

            Happen same here, there is some branchs that jenkins build automatic, but others I need to "Scan Multibranch pipeline now" to  build the others.

            Any help? Thanks

            Show
            diogodias Diogo Dias added a comment - Hi ,   Happen same here, there is some branchs that jenkins build automatic, but others I need to "Scan Multibranch pipeline now" to  build the others. Any help? Thanks
            Hide
            omerh omer haim added a comment -

            Hi

             

            After a lot of web research I found that adding the following hooks (cant say exactly witch one) I guess the first one.

            {{}}

            https://jenkins-url:port/bitbucket-scmsource-hook/notify
            
            https://jenkins-url:port/bitbucket-hook 
            

            Now it works as expected

             

            Show
            omerh omer haim added a comment - Hi   After a lot of web research I found that adding the following hooks (cant say exactly witch one) I guess the first one. {{}} https: //jenkins-url:port/bitbucket-scmsource-hook/notify https: //jenkins-url:port/bitbucket-hook Now it works as expected  
            Hide
            diogodias Diogo Dias added a comment -

            I solved that too. Figured out on a medium website. But thanks for your reply!

            I think first you add the webhook:
            https://jenkins-url:port/bitbucket-hook
             

            After that, you trigger the jenkins for the first time.

            When Jenkins go search for another pipeline projects, he automatically add the other:
            https://jenkins-url:port/bitbucket-scmsource-hook/notify

            Show
            diogodias Diogo Dias added a comment - I solved that too. Figured out on a medium website. But thanks for your reply! I think first you add the webhook: https://jenkins-url:port/bitbucket-hook   After that, you trigger the jenkins for the first time. When Jenkins go search for another pipeline projects, he automatically add the other: https://jenkins-url:port/bitbucket-scmsource-hook/notify
            Hide
            mirceaalbu Mircea-Andrei Albu added a comment -

            For me, the trigger works fine for a multi-branch pipeline, but it doesn't work for single(normal) pipeline.

            Show
            mirceaalbu Mircea-Andrei Albu added a comment - For me, the trigger works fine for a multi-branch pipeline, but it doesn't work for single(normal) pipeline.

              People

              • Assignee:
                Unassigned
                Reporter:
                jorrith Jorrith Schaap
              • Votes:
                41 Vote for this issue
                Watchers:
                49 Start watching this issue

                Dates

                • Created:
                  Updated: