Our team uses jenkins and git. We are looking to implement the advanced feature of the git plugin that allows for pre-builds before pushing commits to the blessed repository. See https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-AdvancedFeatures
However, I am having trouble understanding the whole process.
Here's an excerpt:
Set up your Jenkins project, and leave the 'branch' field in the Git SCM blank. This will cause Jenkins to consider any change on any branch for building.
Next, pick a particular branch name as the integration target in the 'Advanced' section - (e.g. 'master', or 'stable'), and select 'Merge before build'.
Select 'Push GIT tags back to origin repository' from the post-build actions (this is required to update your centralised git repo with the results of the build).
Now, developers should never commit directly to your integration branch (the 'master' or 'stable'). Instead, they should either use feature branches, or create new remote branches on commit (e.g : "git push origin HEAD:refs/heads/myNewFeature"). You could also set up your GIT repository to only accept commits onto the integration branch from Jenkins.
You're done. Commits should now be automatically merged with the integration branch (they will fail if they do not merge cleanly), and built. If the build succeeds, the result of the merge will be pushed back to the remote git repository.
What I understand is,
- Developers create remote branches, from which jenkins will pull from
- jenkins will merge the branch with its integration branch and build
- If the build succeeds, the merge will be pushed to blessed-repo/master.
The question is, if the build fails, what is the state of the integration branch? I would only assume that it somehow reverts back to the commit before the merge. If not, then the integration branch would keep the merge that broke the build, making it impossible for other branches to be merged in and built.
Is this true? Unfortunately, its not clear from the wiki.
Also, does anyone know of an example I can look at?