![](/images/icons/emoticons/warning.gif)
The latest version is v. 5, last edited on Dec 10, 2012
(view differences
|
)
<< View previous version | view page history | view next version >>
<< View previous version | view page history | view next version >>
Situation
It is sometimes desirable to re-produce an already generated build using same SCM revision. This can be useful for a number of reasons for instance when build artifacts get lost, or when you want to re-generate the build with new configuration definition.
Demonstration
Visit latest build of the demo project, and hit the Rebuild button to re-run this build. QuickBuild will generate a new build using same SCM revision as old build and will also make sure that newly generated build using same build version as old build.
Resolution
- Define a rebuild promotion at promotion definitions of the demo project
, with configuration specified as the demo configuration itself, which is root/Build Setup Tutorials/Build Rerun. Upon this, QuickBuild will generate a rerun button at build overview page of the configuration, and hitting this button will cause current build to be promoted to a new build in the same configuration. QuickBuild promotion guarantees that the new build will use the same SCM revision as old build.
- Now we continue to see how the new build uses the same version string as old build. Check general setting of the demo project
, the next build version is defined as:
${groovy: if (vars.getValue("version")!=null) return vars.getValue("version"); else return vars.getValue("major") + "." + vars.getValue("minor") + "." + vars.get("patch").increase(); }
This tells QuickBuild that version of new build should take value of variable version if it is available; otherwise, it should calculate version string based on major, minor and patch variables defined in the configuration.
- Check the promotion definition rebuild
again, and here the promotion is defined with a variable version taking value ${build.version}. This tells QuickBuild to pass variable version to build process using version string of old build as its value.
- With above definition, the new build will use version of old build if it is a result of pressing the rebuild button; otherwise, it will construct its version using the default major.minor.patch format.