Continua CI takes a copy of configuration, project and application variables at the start of each build. These copies are referred to as Build Variables. Any changes to build variables are normally discarded when the build finishes and cannot be used by other builds.

The Persist Build Variable build event handler allows you to save the value of build variables when specific events happen in the build timeline. This is stored as the value of the configuration variable. Subsequent builds will then pick up this revised value and use it as the initial value of the build variable.

Persist Build Variable

Variable Name 

Select an existing variable. The drop down list will show all Configuration, Project and Application variables except for Expression variables which are read only.   

Persist On Build Event

Specify when to persist the build variable by selecting one of the following Build Events:

  • On Before Build Queued
  • On Before Build Start
  • On After Build Started
  • On Before Stage Start
  • On Sending Stage To Agent
  • On Stage Completed
  • On Build Pending Promotion
  • On Before Build Continue
  • On After Build Continued
  • On Build Completed
  • On Before Build Stage Requeued

 Some build events will allow you to specify the Stage or Build Status

Stage

For stage events you can choose the stage name or select "(all stages)"

Build Status

For completion events you can choose the status which triggers the build event handler. This can be Successful, Failed or Any.


Options

Do not persist if modified

Tick this to ensure that we don't overwrite Configuration, Project or Application variables set by other concurrent builds or by other users since the build or stage started.

Since Build Event

Select one of the following Build Events:

  • On Build Created
  • On Before Build Queued
  • On Before Build Start
  • On After Build Started
  • On Before Stage Start
  • On Sending Stage To Agent
  • On Stage Completed
  • On Build Pending Promotion
  • On Before Build Continue
  • On After Build Continued
  • On Before Build Stage Requeued

The value of the Configuration, Project or Application variable is stored on this event and this is compared with the current value before persisting. If the value has changed since this event that the new value will not be persisted.

Log warning if not persisted

A warning is added to the build log if this is ticked and the variable value is not persisted due to the modification check.

Fail build if not persisted

The build will fail if this is ticked and the variable value is not persisted due to the modification check.

Update build variable before persisting

A new tab is displayed when this is ticked with options for setting the build variable value before persisting.


Update Value

You can optionally update the value of the build variable before persisting.

Operation

Choose 'Replace' to overwrite the existing variable value, or 'Append or increment' to make changes to existing values. In the later case, the new value is be appended to the old value for text variable. For numeric variable values, the old value will be incremented by the new value.

New Value

Input the new value for the variable.

Expand variable references in new value

If you select this option then any expression is the value will be expanded before the value is set.


  • No labels