changes.
| h2. Situation |
| For scheduled builds, run them incrementally. However if it is manually triggered, user needs to control whether it is a clean build or an incremental build. |
| |
| h2. Demonstration |
| | Visit the [demo project|http://demo.pmease.com/build/73.latest/], click run button to trigger the build, and the build option screen will present a clean option. QuickBuild will clean up the workspace directory (and this means a clean build for this demo project) before running the build if this option is checked. |
| | Visit the [demo project|http://demo.pmease.com/dashboard/73], click run button to trigger the build, and the build option screen will present a clean option. QuickBuild will clean up the workspace directory (and this means a clean build for this demo project) before running the build if this option is checked. |
| |
| h2. Resolution |
| | # Define a variable _clean_ in [basic setting|http://demo.pmease.com/setting/basic/73/] of the demo project, with prompt setting defined as a checkbox. The default value is set to _false_ indicating all scheduled builds being incrementally. Note that variable name is arbitrary as long as the same name is referenced later. |
| # Switch to [steps view|http://demo.pmease.com/setting/steps/execution/73/] of the demo project. This project defines the clean behavior to be workspace cleanup before running the build, and _pre-execute script_ of the master step is defined as below to achieve this purpose: |
| | # Define a variable _clean_ in [variable setting|http://demo.pmease.com/settings/73/variables] of the demo project, with prompt setting defined as a checkbox. The default value is set to _false_ indicating all scheduled builds being incrementally. Note that variable name is arbitrary as long as the same name is referenced later. |
| # Switch to [step setting|http://demo.pmease.com/settings/73/steps] of the demo project. The _pre-execute action_ of the master step is defined as below to clean the workspace if variable _clean_ is set to _true_: |
| {code} |
| if (vars.get("clean").asBoolean()) |
| util.cleanDir(configuration.workspaceDir); |
| {code} |
| If build is triggered by scheduler, default value of the variable will be used, which is _false_, and workspace directory will not cleaned. If triggered manually, the variable value will be either _true_ or _false_ depending on whether or not the user has checked the _clean_ option. |
| |
| | {info}This demo treats clean build as cleaning up the workspace directory before running the build. However, your clean build might have a different behavior, for example, cleaning up a sub directory under the workspace before running master step, or even deleting certain files before running certain steps. All of these logic can be customized using the _pre-execute script_ and _post-execute script_ of various steps. You may even use multiple variables to control the clean behavior.{info} |
| | {info}This demo treats clean build as cleaning up the workspace directory before running the build. However, your clean build might have a different behavior, for example, cleaning up a sub directory under the workspace before running master step, or even deleting certain files before running certain steps. All of these logic can be customized using the _pre-execute action_ and _post-execute action_ of various steps. You may even use multiple variables to control the clean behavior.{info} |