Situation: Our company creates software releases that are built using Hudson from code in a git repository. Sometimes, we need to reproduce a build of a previous version because a trial period has expired. This poses a problem since we need to find the code version corresponding to that software version. Our developers do not work using tags or branches, as it does not fit our working style.
As a solution to this problem, I thought we should include an automated tagging system every time a build is succesful.
The workflow I had in mind is the follwoing (executed on our build-machine):
- Toss all local changes if any were made:
git checkout .git clean -df - Get latest version:
git pull - Go to desired version
git checkout .orgit checkout <tag> - Build software
- If successful: tag current version, and push tag to repository:
git tag -m "automated tag" versionXXXgit push --tags
I have 3 questions regarding this way of working:
- Are there any obvious flaws in this way of working? (Vague, I know – sorry)
- For this usecase, is there any advantage to using annotated tags over lightweight tags? Most posts recommend annotated tags, but I’m not really seeing the added value, especially for this use case.
- Our software consists of multiple modules, each having their own git repository. Some of these modules hardly get updated. Is there any downside to having a lot of tags pointing to the same commit?
Nope.
No, if you’re not putting anything meaningful into the tag message, there’s no real point in creating one in the first place. There is no real disadvantage (they hardly use up any space).
If you get any results from the build, you could put those in the tag comment (unless you have other logging mechanisms which are checked anyway), e.g. number of warnings, or something like that.
Nope, other than possibly cluttering up the tag namespace (a tag name must be unique to the repo), there’s no problem. As mentioned, they hardly use any space.
If redundant tags are any problem, you could implement a strategy like: If the tag of the previous build points to the same commit I’d like to tag right now, don’t tag it. If you look up the tag for a specific version, use the tag with the latest version before the one you’re specifying. (That’s only feasible if the lookup is automated; otherwise just re-tag the commit.)