I have set up a jenkins instance for a multibranch svn project which is triggered by a post-commit hook passing affected branche's name as parameter to jenkins.
Jenkins then does checkout sources from given branch and compiles them. This works quite well with one restriction.
If builds "x" and "x+1" do run on same branch jenkins shows me the changes for the commit, which triggered build "x+1" under the changes link for the build. If builds "x" and "x+1" run on different branches i get an empty changes list in jenkins and the line "No revision recorded for in the previous build".
My question is now: how can i let jenkins take changes not based to previous build, but to last successfull build based on the same branch?
1 Answers
As far as i know, Jenkins always computes the changes based on the previous build in a specific job. So if you are running multiple branches in the same job, then you're out of luck. I would suggest that you look into one of the following plugins:
https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Multibranch+Plugin Pipelines seems to be the way to go no a days, you add a Jenkinsfile to your repository which tells Jenkins how to build you project. The Multibranch plugin extends this with additional features where it will detect new branches and create new sub-jobs
https://wiki.jenkins-ci.org/display/JENKINS/Multi-Branch+Project+Plugin If you're stuck with freestyle jobs, then try this one, as I understand it it is freestyle jobs but creates new sub-jobs for each branch. But as it says on the link, it has been superseded by Pipelines and Multibranch pipelines.