Hudson deploy specific git revision

Posted by brad on Server Fault See other posts from Server Fault or by brad
Published on 2009-12-28T20:59:36Z Indexed on 2010/06/02 15:34 UTC
Read the original article Hit count: 347

Filed under:
|
|

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)

© Server Fault or respective owner

Related posts about automation

Related posts about git