Skip to main content
Version: QB70

Control Release Candidate and Release Version

Situation

Assume we have:

  1. A release candidate configuration which is used to build release candidates of your software.
  2. A release configuration which is used to release your software.

Now we want to control build version of these two configurations so that:

  1. Version of builds in release candiciate configuration is composed of the release part and the candidate part, with the release part using the version to be released, and candiciate part increasing automatically for each build. For example, we are going to release 1.0 , and candidate builds should use versions in form of: 1.0-rc1 , 1.0-rc2 , 1.0-rc3, ...
  2. When a release candidate build is promoted as release build, the release version should be automatically increased, and the candidate version should be reset to 1 . For example, after 1.0 is released, new builds in release candidate configuration should use versions in form of: 1.1-rc1 , 1.1-rc2 , 1.1-rc3, ...

Demonstration

  1. Click here and press the run button to generate new release candidate builds. The rc part of the build version will be automatically increased.
  2. After the build finishes, switch to latest release candidate build, and click the promote button to promote a release candidate build as release build. A new release build will be generated in the release configuration.
  3. Return back to release candidate configuration and run it to generate a new build. The release part of the new build version will take value of next release number, and the rc part will reset to 1.

Resolution

  1. Define three variables in variable setting of project level configuration, respectively:

    • rc
      This variable is used control rc part of release candidate builds.
    • major
      This variable is used to control major part of the release version.
    • minor
      This variable is used to control minor part of the release version.
  2. Define next build version in general setting of release candidate configuration like below:

    ${vars.get("major")}.${vars.get("minor")}-rc${vars.get("rc").increase()}

    This tells QuickBuild to use current value of variable major , minor , and rc to construct release candidate build version, and increase the rc variable by one after usage.

  3. Define next build version in general setting of release configuration like below:

    ${vars.get("major")}.${vars.get("minor").increase()}

    This tells QuickBuild to use current value of variable major and minor to construct release build version.

  4. Configure a step in step setting of release configuration to execute below script:

    vars.get("rc").setValue(1)

    This script is executed by the master step in the demo site for simpliticy reasons, and it tells QuickBuild to reset rc variable to 1 when a new release is generated.