Unable to trigger build using 'Poll SCM' and Git notifyCommit option

13.2k views Asked by At

We use Jenkins (1.614) and have Git as version control tool. The Git plugin version is 2.3.5. I am trying to trigger build only after every check-in since continuously polling is too expensive. I tried the following method described in various links but it’s not working:

  1. Enabled ‘Poll SCM’ and assigned a dummy value. I also tried without assigning any value.
  2. Added following line in post-receive hook:

curl http://jenkins_url:9099/jenkins/git/notifyCommit?url=ssh://gitolite@git_server/TestRepo

  1. Now if I commit some changes, I get the following message during push:

$ git push origin release-test
Counting objects: 20, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 308 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Commit ID: 3a9cddadasd
remote: Returning result 0
remote:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
remote:                                  Dload  Upload   Total   Spent    Left  Speed
remote: 124   124  124   124    0     0     30      0  0:00:04  0:00:04 --:--:--   497
remote: Scheduled polling of Poll_Job
remote: No Git consumers using SCM API plugin for: ssh://gitolite@git_server/TestRepo

  1. When I see the Git Polling Log, I notice the following:

Started on Jun 10, 2015 6:42:04 PM
No existing build. Scheduling a new one.
Done. Took 0 ms
Changes found

I do see the build # getting incremented after every such poll for few seconds but 'Build History' remains empty as shown below. No steps that are part of the build are executed.

enter image description here

Any inputs why the build is not getting triggered as expected?

1

There are 1 answers

1
Noam Manos On

Take a look at the build "Git Polling Log", it might indicate the problem. I had similar issue where Maven job with a trigger by "Poll SCM" from Git, stopped triggering new builds. Apparently the cause was:

ERROR: Failed to record SCM polling ... undefined method `add' for nil:NilClass at Jenkins::Model::Build.initialize(C:/Jenkins/plugins/nodeofflinenotification/ ...

Then I noticed that "Node Offline Notification Plugin" is deprecated, so I uninstalled it (and installed "Mail Watcher Plugin" instead), and SCM polling worked again.