Jenkins polls a wrong branch

Viewed 3531

I have configured my branch for a Pipelines project like this:

*/master

However, according to the Git poll log:

[poll] Latest remote head revision on refs/heads/ci_test is: c945253a1f3aed6be113347e37aa3512db43bcf0 - already built by 17 Done. Took 11 sec No changes

It always tries to poll ci_test that was the branch I initially tested with. Same thing with BitBucket webhook. It reacts only on the ci_test branch despite that fact that only master is now configured, applied and saved. I also tried to restart Jenkins with no luck.

Any ideas how to debug this?

Edit: If I trigger the build manually it builds master. The poller still polls ci_test no matter what. Wtf?

Edit2: Setting the branch to any (leave blank) fails to fetch anything even manually.

6 Answers

The solution that worked for me was:

  • Delete all configuration related to polling (trigger clause in the pipeline, polling configuration in the job)
  • Run a build manually (it should build the correct branch)
  • Restore polling configuration

After these changes, polling restarted and began to query the correct branch.

The "solution" was to move on to a Multibranch Pipelines project. The legacy Pipelines project seems to be confusing and broken with multiple branches anyway:

https://issues.jenkins-ci.org/browse/JENKINS-46588

Additionally the webhook might also be somehow buggy, but this multi-branch project type seems to be working much better.

For me the issue was that I had specified "Branch Specifier" as */* and changing that to empty value fixed the problem, as instructed: (blank for 'any').

Probably for you case you should put 'master' instead of */master

Seems to be that the problem is with webhook on BitBucket, not with Jenkins configuration. Probably webhook was created for ci_test branch and now doesn't see the changes for master branch.

Be sure that you don't have enabled the Lightweight checkout checkbox in the Pipeline section.

Unfortunately, it's not compatible to Bitbucket webhook plugin..

Related