13

I've installed Webhook to Jenkins for Bitbucket plugin in bitbucket server. The main goal is that a jenkins build will be triggered after a commit.

After the install I've enabled the plugin: jenkins-url: https://url/jenkins ssh: ssh@git.. (same command is used in SCM plugin jenkins job).

The jenkins job works (git clone etc works) but the plugin isn't working. When I click test on the jenkins webhook plugin it shows me:

Error: Jenkins response: No git jobs using repository: ssh://git@xx.git t and branches: master 

The URL is right. So it is used in my jenkins job (and branch master). I've even copied the url from the error as URL in the jenkins job and it is still able to clone the repo. What do I forget?

EDIT:

I found some info that you should enable SCM polling in your job (even if this is polling once in a year). Only than this plugin will work? Is this the normal behaviour? (it seems to fix my issue)

DenCowboy
  • 13,884
  • 38
  • 114
  • 210

4 Answers4

11

Yes, you have to check Poll_SCM in the Build Triggers section of your Jenkins Job configuration - I can confirm this. I'm doing the same thing you are and that's how I got it to work - you can find confirmation of such at the Atlassian site

randomNerdboy
  • 320
  • 1
  • 3
  • 14
  • 2
    Multibranch Pipeline Jobs do not appear to have a `Build Triggers` section in Jenkins 2.176+. There *is* a `Scan Multibranch Pipeline Triggers` section with a `Periodically if not otherwise run` property. Enabling this doesn't help one way or the other. – alex Nov 08 '19 at 18:39
  • 1
    FWIW: you may also need to trigger the job in Jenkins and allow it to run to completion before the git job is registered. I've seen examples where the Build Trigger and repo were both correctly set and until the job had run once Jenkins still reported that no job was using the repository – Carcophan Oct 07 '20 at 15:02
4

Configure your project. Under Triggers, make sure that Poll SCM is checked.

You can enter a schedule if you want, but you don't have to. If no schedule is entered, it should display something like "No schedules so will only run due to SCM changes if triggered by a post-commit hook".

farrellw
  • 1,340
  • 15
  • 12
3

For me the problem was that BitBucket was using all lower case git url but jenkins was internally using the url with parts in the original case and therefore it found not machting project. Adding an custom url fixed the issue for me

Fritz
  • 831
  • 7
  • 23
-1

Enable the SCM polling, leave it blank and don't mention anything in schedular. This way SCM plugin is going to get response from bit bucket, and ignore the error if "No git jobs using repository"- if http status is 200, it should work properly..

Rizwan Javid
  • 582
  • 6
  • 12