Closed javiplx closed 9 years ago
I've refactored this a bit, moved has_changes?
to project and added specs.
@javiplx
I had to revert related changes due to an issue with determining if there were changes.
Namely, if previous build was for a feature/x
branch, and the new commit is for master
branch, it will not trigger the build, and it should. See hudson.model.AbstractProject.poll and jenkins.model.lazy.LazyBuildMixIn.getLastBuild for details.
I've created a separate branch with related code: https://github.com/elvanja/jenkins-gitlab-hook-plugin/blob/feature/do_not_trigger_when_no_scm_changes/models/values/project.rb#L78.
Unless we can think of a reasonable solution for this, I am afraid I'll have to leave this one out.
Any ideas?
That sound very strange to me. If that is the case it would be a bug of the git plugin, and should affect other plugins, in particular the github and the other gitlab plugin, from where I take the poll method. We don't really have projects with multiple branches, except those that build tags (using $BRANCH_TO_BUILD), and they seem to work with no problem, although tags are a bit different than branches. In any case, I'll try to setup a project to test what you say.
This avoids to build jobs that should be prevented by advanced git plugin configuration, such as directory exclusion.