Reputation: 303
I'm in a quandry using git with nightly builds. If we clone the repo every day at 12:01am, build it and test it then how can we guarantee we get the same build every time?
The first method is to tag the build. We'd pull the tag and build. The problem is our system becomes littered with tags. We could delete tags, but there's always a chance someone will need a deleted tag.
The second method is git checkout git rev-list
by date/time. The flaw is that change sets are time stamped at the time of commit - not when they're pushed. So if someone does a commit (but no push) at 9pm on 7/30/13 and then a push the next day on 7/31/13. Doing:
git checkout `git rev-list -n 1 --before="2013-07-31 0:01" master`
gets different results depending on whether or not the checkout was done before or after the push.
Am I misunderstanding something or is there a better way to do this in git?
Upvotes: 0
Views: 149
Reputation: 28951
First of all, there is no point to clone a repo everytime, it is too slow. Just do it once, then pull changes, use git clear -xdf
to make a pristine wc before each build. Secondly, tags are cheap. If you run build everyday, it will create ~1000 tags in 3 years, each tag is less than 100 bytes, so you end up with 100kb per 3 years. Why do you care?
The repository which is used for builds could create tags locally and don't push it to main repository. It means if you need a tag, you could go to the repo directly and find a tag. If you look to a CI server (e.g. Jenkins) it tags each build automatically, and by default doesn't push tags back. Not sure why you are not using one already, you should consider it.
Upvotes: 5