Version Number Plugin

Skip to end of metadata
Go to start of metadata

Plugin Information

Plugin ID versionnumber Changes In Latest Release
Since Latest Release
Latest Release
Latest Release Date
Required Core
Dependencies
1.5 (archives)
Mar 08, 2015
1.576
Source Code
Issue Tracking
Maintainer(s)
GitHub
Open Issues
Rosberg Linhares (id: rosberglinhares)
Andrew Bayer (id: abayer)
Cedric Chabanois (id: cchabanois)
Usage Installations 2014-Mar 2777
2014-Apr 2801
2014-May 2903
2014-Jun 2957
2014-Jul 3088
2014-Aug 3112
2014-Sep 3223
2014-Oct 3325
2014-Nov 3316
2014-Dec 3304
2015-Jan 3435
2015-Feb 3500

This plugin creates a new version number and stores it in the environment variable whose name you specify in the configuration.

Configuration

In many cases, the hudson build number isn't rich enough to express the information you'd like the version number to have, and generating externally (as part of the build) may not be an optimal solution. This plugin allows you to generate a version number that contains much more information.

Project start date

The version number system has the concept of builds per day/month/year/all time. Each of these is the calendar day/month/year; that is, all builds in October will have the same build month, all builds in 2009 will have the same build year. These are based on the project start date, which is one of the user-configurable options.

Version Number Format String

The version number format string is processed to create the version number that's stored in the named environment variable. Every character in the version number format string is passed through to the final version number, with the exception of variables enclosed in ${}. For example, the version format string 1.0.${BUILDS_THIS_YEAR}, if this were the 10th build this calendar year, would return 1.0.10.

The following are valid variables for use in the version number format string:

name function
BUILD_DATE_FORMATTED Takes the second argument and returns a java-formatted date string for the given build date. For example, ${BUILD_DATE_FORMATTED, "yyyy-MM-dd"} would return the date (and not the time) as something like 2009-10-01. The date format string must be surrounded by quotes, and any whitespace within the format string is significant.
BUILD_DAY With no arguments, it just returns the day of the build as an integer. If there is an argument, it takes the number of characters in the argument and uses that pad the date string. For example, if it's the third of the month, ${BUILD_DAY} would return 3, ${BUILD_DAY, X} would return 3, and ${BUILD_DAY, XX} would return 03.
BUILD_MONTH Returns the month, with the same argument convention for BUILD_DAY
BUILD_YEAR Returns the year, with the same argument convention for BUILD_DAY
BUILDS_TODAY Returns the number of builds that have happened today, including this one. This resets at midnight. The argument convention is the same as for BUILD_DAY
BUILDS_THIS_MONTH Returns the number of builds that have happened this month, including this one. This resets at the first of the month. The argument convention is the same as for BUILD_DAY
BUILDS_THIS_YEAR Returns the number of builds that have happened this year. This resets at the first of the year. The argument convention is the same as for BUILD_DAY.
BUILDS_ALL_TIME Returns the number of builds that have happened since the project has begun. This is distinct from the hudson build number, in that it can be reset periodically (for example, when moving from 1.0.${BUILDS_ALL_TIME} to 2.0.${BUILDS_ALL_TIME}, and can be configured to start at an arbitrary number instead of the standard begin date.
MONTHS_SINCE_PROJECT_START The number of months since the project start date. This is strictly dependent on the month of the current build and the month of the project start date; if the project was begun October 31st and the build was November 1st, then this would return 1. If the project was begin October 1st and the build was November 30th, this would also return 1. The argument convention is the same as for BUILD_DAY.
YEARS_SINCE_PROJECT_START The number of years since the project start date. Like MONTHS_SINCE_PROJECT_START, this is dependent only on the year;
(anything else) Any other argument enclosed in ${} is replaced by an environment variable of the same name if one is available, or failing that, is just ignored. This can be used to integrate source control version numbers, for example.

Initialization Values

The number of builds this year/month/day can be specified on the command line before the build is started. If they are specified, then they will override whatever values are currently in production. This allows you to migrate your version number from another system to hudson if you choose.

Releases

Version 1.4

  • Release Dec 17, 2011
  • Display name for every build can now be set to the formatted version number generated by this plugin

Version 1.3

  • Released Dec 21, 2009
  • Largely for compatibility reasons - was using rather old deprecated methods and wouldn't actually work with modern Hudson builds.

Labels

Edit
plugin-buildwrapper plugin-buildwrapper Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Add Comment