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

Build trigger using Bitbucket webhook not working

      Dear Jenknis team,
      We fail to setup automatic build triggering in Jenkins using Bitbucket webhooks.
      The Bitbucket Server Integration plugin is installed and configured, following the official integration manual
      The triggering method is configured via Bitbucket webhook trigger. The webhook itself is successfully created in Bitbucket and build status is updated as well (builds can be invoked manually from Bitbucket and complete successfully in Jenkins).
      Triggering builds after commit / push / merge is not working though, even when the webhook is active and the latest responses are: http code 200 (success).
      Any idea how we can make it work? Please refer to the screenshots as well.

      The Jenkins log file reports:

      INFO    c.a.b.j.i.t.BitbucketWebhookConsumer#lambda$hasMatchingRepository$6: Base URL of incoming repository selflink - https://xxxxxxxxxx and bitbucket server configured URL - http://xxxxxxxxxx:7991 seems to be be different

      Thank you!

          [JENKINS-68496] Build trigger using Bitbucket webhook not working

          Martin Henschke added a comment - - edited

          Hi Andrey, thanks for raising this.

          The different base URL and webhook URL (and protocol) suggest to me this is a dupe of JENKINS-68589. Can you confirm if you're exposing Bitbucket via HTTPS (with a load balancer or similar), but are using the HTTP as your base URL in Jenkins?

          Martin Henschke added a comment - - edited Hi Andrey, thanks for raising this. The different base URL and webhook URL (and protocol) suggest to me this is a dupe of JENKINS-68589 . Can you confirm if you're exposing Bitbucket via HTTPS (with a load balancer or similar), but are using the HTTP as your base URL in Jenkins?

          Andrey Tsolev added a comment -

          Hello Martin,

          Thank you for the feedback.

          Our Bitbucket server is exposed via https only and is accessible with pre-installed personal security certificates, issued by CA. It is also behind a firewall.

          This is why we have enabled internal connectivity Jenkins --> Bitbucket via http and on port 7991, otherwise the communication with Bitbucket does not work.

          Any way to force the build to trigger? I see you have mentioned some "sysprop" in https://issues.jenkins.io/browse/JENKINS-68589? Hopefully the port within the base URL in Jenkins does not make it even more complex.

          Thanks!

          //Andrey Tsolev

          Andrey Tsolev added a comment - Hello Martin, Thank you for the feedback. Our Bitbucket server is exposed via https only and is accessible with pre-installed personal security certificates, issued by CA. It is also behind a firewall. This is why we have enabled internal connectivity Jenkins --> Bitbucket via http and on port 7991, otherwise the communication with Bitbucket does not work. Any way to force the build to trigger? I see you have mentioned some "sysprop" in https://issues.jenkins.io/browse/JENKINS-68589? Hopefully the port within the base URL in Jenkins does not make it even more complex. Thanks! //Andrey Tsolev

          Hi Andrey,

          From your description I believe this is a dupe so I'll mark it as such. Regarding your question to force the build trigger, I refer you to the conversation on that ticket, but in tldr your builds aren't being triggered because Jenkins recognizes a webhook as being related to a particular instance by it's URL (the body of the webhook itself is otherwise generic). If we cease to do that checking, a webhook from any source can be used to trigger a build which poses stability and security concerns for an instance.

          The bug is open to provide a sysprop for Jenkins to ignore the protocol, providing the URLs are otherwise matching, so consumers can forego issues with certificates. Let me know if this does not apply to you.

          Martin Henschke added a comment - Hi Andrey, From your description I believe this is a dupe so I'll mark it as such. Regarding your question to force the build trigger, I refer you to the conversation on that ticket, but in tldr your builds aren't being triggered because Jenkins recognizes a webhook as being related to a particular instance by it's URL (the body of the webhook itself is otherwise generic). If we cease to do that checking, a webhook from any source can be used to trigger a build which poses stability and security concerns for an instance. The bug is open to provide a sysprop for Jenkins to ignore the protocol, providing the URLs are otherwise matching, so consumers can forego issues with certificates. Let me know if this does not apply to you.

          Andrey Tsolev added a comment -

          Thanks, Martin.

          I'll review https://issues.jenkins.io/browse/JENKINS-68589 for updates regarding the sysprop for Jenkins to ignore the protocol.

          Regards,

          //Andrey Tsolev

          Andrey Tsolev added a comment - Thanks, Martin. I'll review https://issues.jenkins.io/browse/JENKINS-68589 for updates regarding the sysprop for Jenkins to ignore the protocol. Regards, //Andrey Tsolev

            cdelmonte Christian Del Monte
            tsoleva Andrey Tsolev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: