I'm using hudson to auto-deploy my Rails app to heroku. In my main build job I pull from a Git repo (hosted using gitosis on the same machine), master branch with the following:
URL of repository: /home/git/repositories/my_app.git
Name of repository: origin
Refspec: +refs/heads/master:refs/remotes/origin/master
Branches to build: master
Then, assuming all tests pass, I want to kick off a new build that is the deploy to Heroku.
I can't however figure out how to get that deploy build to checkout the particular revision that this build was using. I understand there's a parameterized trigger plugin that would allow me to pass this revision number, but I don't know how I can tell hudson to checkout this particular revision on the deploy build.
I'm pretty sure this just has to do with my limited knowledge of git, but where in the hudson git config's is there an option to checkout a particular revision?
Otherwise, I could have many commits happen whilst a build is happening, and when it kicks off a deploy build, that deploy build would just check out the HEAD of the branch, which may not be the same as the code that was pushed that triggered this build.
I don't fully understand why I have a refspec in Hudson, then also specify a branch to build, I thought this was the same thing. Can refspec somehow specify the revision number? How would this be referenced if it was passed through with the parameterized trigger plugin?
(I've never used that plugin, but someone else recommended it as a way to pass in vars to a new build, if there's another way I'm all ears)
See here for an git explanation.
BTW, do you store the deployable artifacts in git or do you rebuild your app before deploying? Otherwise let your first job push the artifacts into a repository (can be different than the one for source code, we have a designated space on the file system) and the second job pulls it from the repository and deploys it.
I think that you can do this more easily by setting up the steps in hudson to run your tests and then push, if your tests return a non-zero exit on failure. This works because I think hudson will stop executing the chain of build steps as soon as there's a failure (non-zero exit status).