The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

Version Number Plug-In

VersionNumber: Determine the correct version number

  • versionNumberString

    The version number format string is used to generate the version number. It will be passed through unaltered, except that any expression of the form ${variable_name, argument} will be replaced according to the table below. Arguments are optional, and, unless otherwise specified in the table below, the argument is a string of length N, and the number will be left-padded with zeros until its length equals N. It will not be padded if its length already exceeds N. For example, if the build day is 5, then ${BUILD_DAY, XX} would return 05.

    Any variable not recognized in the table below will be replaced by an environment variable of the same name. So to use the hudson build ID, stored in the environment variable BUILD_ID, you'd just use ${BUILD_ID}. If no environment variable of the appropriate name can be found, the expression will just be replaced with an empty string.

    BUILD_DATE_FORMATTED If the argument for this is a quotes-enclosed java date format string, then this will be replaced with the build date formatted with that string. If there is no argument, then this will be the standard simple date format.
    BUILD_DAY The day of the build.
    BUILD_WEEK The week of the year of the build.
    BUILD_MONTH The month of the build.
    BUILD_YEAR The year of the build.
    BUILDS_TODAY The number of builds done on this calendar date.
    BUILDS_THIS_WEEK The number of builds done in this calendar week.
    BUILDS_THIS_MONTH The number of builds done in this calendar month.
    BUILDS_THIS_YEAR The number of builds done in this calendar year.
    BUILDS_ALL_TIME The number of builds done since the beginning of the project.
    MONTHS_SINCE_PROJECT_START The number of calendar months that have elapsed since the project start date.
    YEARS_SINCE_PROJECT_START The number of calendar years that have elapsed since the project start date.

    Note: BUILDS_TODAY_Z, BUILDS_THIS_WEEK_Z, BUILDS_THIS_MONTH_Z, BUILDS_THIS_YEAR_Z and BUILDS_ALL_TIME_Z are zero-indexed versions of the similar named variables from above. The override build numbers are NOT zero indexed, however, if you override Builds Today with 3, then BUILDS_TODAY_Z will be 2 for the next build.

    • Type: String
  • overrideBuildsAllTime (optional)
    • Type: String
  • overrideBuildsThisMonth (optional)
    • Type: String
  • overrideBuildsThisWeek (optional)
    • Type: String
  • overrideBuildsThisYear (optional)
    • Type: String
  • overrideBuildsToday (optional)
    • Type: String
  • projectStartDate (optional)

    The date the project began, in the format yyyy-MM-dd. This is used in calculating the number of months and years since the beginning of the project.

    • Type: String
  • skipFailedBuilds (optional)
    • Type: boolean
  • versionPrefix (optional)

    The prefix which is added in front of the version number to allow using the same build numbers for all the release tags.

    If this prefix contains a variable that should be substituted, make sure that the prefix is enclosed in double-quotes for variable-substitution to take place!

    Note that different to freestyle jobs, the version prefix is always automatically added to the front of the returned version and does not have to be manually specified within the version number string.

    • Type: String
  • worstResultForIncrement (optional)

    If the former build-run's result is worse than the one selected here, this will not cause the build numbers for builds today / this week / this month / this year / all time to be incremented for the next build. Basically, this keeps "non-successful" builds from "eating" build numbers. Other rules apply; for example, if a failed build is fixed on the first build of the next day, then BUILDS_TODAY will be 1 for the fixed build.

    • Type: String

Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

    


See existing feedback here.