Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins GitHub Plugin Inverse Branches

I have a question in on the plugins page, but this seems to be a much more active place for Jenkins support.

When a change is pushed to any branch the job will run, and merge into the develop branch, but approx 20 seconds later the job will notice the merge into develop and trigger the job again. This should not happen because develop is in the branches to build (with inverse choosing stragety). This also happens when a change it pushed to master or release, which also should be excluded. If there is a merge failure then the job will start a never ending loop trying to merge the branches until the conflict is manually resolved.

I have also tried to exclude a specific user from triggering builds, also to no effect.

I am beginning to assume that the Github plugin does not respect the choosing strategy or the other git plugin options.

Hopefully the below information is all that is needed to help me wrap my head around this issue.

GitHub Plugin                => 1.5
GitHub API Plugin            => 1.40
GitHub Pull Request Builder  => 1.7
GitHub Authentication Plugin => 0.13.1
Jenkins GIT Plugin           => 1.3.0
Jenkins GIT client Plugin    => 1.0.5

Interesting Configuration options from build

Branches to build

master,**master,release,**release,develop,**develop

Excluded Users

jenkins
ConvergintJenkins

Merge options

✓ Merge before build
Branch to merge to
    develop

Disable submodule processing ✓

Choosing stragety

Inverse

Build Triggers

✓ Build when a change is pushed to github
✓ Poll SCM

Git Polling Log

Polling has not run yet.

Github Hook Log

Started on Apr 30, 2013 3:53:14 PM
Using strategy: Inverse
[poll] Last Built Revision: Revision bde1981da849dbfb2fd93aac4de05fd5a832043b (origin/ach)
Fetching changes from the remote Git repositories
Fetching upstream changes from origin
Polling for changes in
Seen branch in repository origin/develop
Seen branch in repository origin/feature-228
Seen branch in repository origin/feature-249
Seen branch in repository origin/master
Seen branch in repository origin/release
Done. Took 1.4 sec
Changes found
like image 449
Rockstar04 Avatar asked May 01 '13 18:05

Rockstar04


1 Answers

It looks like you've got two problems here.

  1. The branches you don't want to build are being built.
  2. You're seeing some funky merging behaviour (probably as a result of the above point).

I think your diagnosis is correct - I am beginning to assume that the Github plugin does not respect the choosing strategy or the other git plugin options.

I've had problems with the various GitHub plugins in the past too. They have some nice configuration options and can do some clever things but ultimately can be a bit flaky. I strongly believe that there should be absolutely no place for flakiness in a CI pipeline (as it will lead to a lack of trust in it).

In my opinion you cannot go wrong if you strip everything back to basics. Use the Jenkins Git plugin and treat GitHub as you would any Git repository. Set up SSH or similar (useful help article here) and a decent polling interval and you shouldn't run into any problems!

I have set up hundreds of Jenkins jobs in this manner for my organisation which uses private GitHub repositories. Hope this helps.

like image 139
ben.snape Avatar answered Nov 05 '22 13:11

ben.snape