buildnumber-plugin: sequential build numbers with Git

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

buildnumber-plugin: sequential build numbers with Git

Jörg von Frantzius
Hi,

it's a common requirement to automatically have sequential version numbers being generated for artifact versions, e.g. based on SVN revision numbers. Such sequential version numbers can then be used for detection of updates of software modules, e.g. Netbeans modules or Magnolia modules.

While the buildnumber-plugin does provide this for Subversion, it doesn't do so for Git,  and there is a corresponding open issue for the buildnumber-plugin https://jira.codehaus.org/browse/MBUILDNUM-93. There wasn't progress on that issue since a patch was supplied one year ago, and the problem with that patch seems to be that it replaces the currently used SHA entirely with the number of commits.

Git itself does provide a similar feature with git describe (https://www.kernel.org/pub/software/scm/git/docs/git-describe.html), where a buildnumber is composed from commit number followed by short SHA. A resulting artifact version would look like this: "1.0.4-14-g2414721", where "1.0.4" is a manually maintained version number, and "14-g2414721" is what the buildnumber plugin could generate.

I'd now be curious whether others also think that this approach would be suitable for the buildnumber plugin?

This numbering scheme would result in automated version numbers that are orderable within the same Git branch. There could be confusion only if e.g. developers have local commits on the same branch without merging other developers' changes on the same branch, and if they then exchange locally built artifacts (.jars). In a setup of some continuous integration system building from a single Git repo, version numbers would always remain sequential for artifacts produced by the CI system.

In the worst case mentioned above, locally build artifact versions may not sensibly be orderable, but they at least always remain distinguishable due to the SHA short hash.

Thanks for any thoughts,
Jörg

--
Dipl. inf. Jörg von Frantzius, System Architect

Email [hidden email]
Phone +49 30 283921-318
Fax +49 30 283921-29

Aperto AG - In der Pianofabrik
Chausseestraße 5, D-10115 Berlin-Mitte
http://www.aperto.de
http://www.facebook.com/aperto
https://www.xing.com/companies/apertoag

HRB 77049, AG Berlin Charlottenburg
Vorstand: Dirk Buddensiek (Vorsitzender), Kai Großmann, Stephan Haagen
Aufsichtsrat: Bernd Hardes (Vorsitzender)