8
votes

I'm trying to implement a modified Integration-Manager workflow similar to what's described in ProGit.

Diagram of the Integration-Manager workflow

Instead of an integration manager performing the merges, I want developers to merge locally before publishing their code, and I want a Quality Gateway that enforces our continuous integration standards, such as a minimum level of code coverage and 100% tests passing, before allowing code to enter the blessed repository to be checked out by other developers. The idea is that the code in the blessed repository always meets the minimum standard we define and always builds.

I want Jenkins to perform the role of the quality gateway, only pushing code to the blessed repository when builds succeed.

So far, I have set up the system so that there are the following public repos: the blessed repository, a repository on the build server for Jenkins, which is a bare repo accessed through gitosis, and of course developer's own repositories.

I have developers pulling from the blessed repo and pushing to the integration repo. Now I'm trying to get Jenkins to push successful builds from the integration repo to the blessed repo.

So far, the only option I've seen that seems similar to what I'm trying to achieve is the "Push Only If Build Succeeds" option in the Git Publisher settings of the Post Build Actions in Jenkins' project configuration. However, that options doesn't allow you to specify the push url or remote to push to.

As I understand it, the Git Publisher settings would push the repo Jenkins' clones into its workspace back into Jenkins' public repo, but I want to push to a different remote, the blessed repository.

Does anyone have any suggestions how I can get Jenkins to push to the blessed repo?

EDIT 0: I tried putting a Post Step to execute the push command to my blessed repository. This appears to work, in that there are no errors. However no changes are being pushed and the logs show that git thinks everything is up to date:

[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESSFUL 
[INFO]     ------------------------------------------------------------------------ 
[INFO] Total time: 1 minute 7 seconds 
[INFO] Finished at: Fri Nov 18 16:10:50 UTC 2011 
[INFO] Final Memory: 19M/45M 
[INFO] ------------------------------------------------------------------------ 
channel stopped 
[My Project] $ /bin/sh -xe /tmp/hudson5604254372179801803.sh + git push [email protected]:my-project.git --all
Everything up-to-date

I don't know why git thinks there's nothing to push, because there definitely is.

2

2 Answers

2
votes

How about using the Jenkins "Push Only If Build Succeeds" action, with a post-commit or post-receive hook on the integration repository, to push to the blessed repository whenever Jenkins pushes after a successful build?

1
votes

Have you considered adding Gerrit to your workflow. Changes are pushed to Gerrit and then your CI runs a build and reports on your tests. It can be set up so that other approvals (like authorized code reviews) are needed before it is merged into your blessed repo. EGit uses it in their development, http://egit.eclipse.org/r/ . There are other discussions of this workflow as well, like, alblue's blog.