juzzlin
juzzlin

Reputation: 47865

Jenkins polls a wrong branch

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.

Upvotes: 5

Views: 5267

Answers (6)

PHZ.fi-Pharazon
PHZ.fi-Pharazon

Reputation: 2073

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

Upvotes: 1

Panos Antonakos
Panos Antonakos

Reputation: 1

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..

Upvotes: 0

lknop
lknop

Reputation: 76

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.

Upvotes: 5

andrew lorien
andrew lorien

Reputation: 2678

I have this issue (our Jenkins server hasn't been updated for a couple of years, so pretend the date on this post is 2017). I believe it's because of this bug (I believe both are the same problem):

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

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

I don't have a solution, although I'll update this answer if the multi-branch pipeline works.

Upvotes: 0

juzzlin
juzzlin

Reputation: 47865

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.

Upvotes: 1

biruk1230
biruk1230

Reputation: 3156

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.

Upvotes: 0

Related Questions