Custom Log Messages provide a way for processes executed by Continua CI to interact with the Continua CI build. This includes the ability to set the build number, set variables and send real time status information. This feature will be extended over time.

Message Format

@@continua[messageType parameter='value' parameter='value']

Note that the messageType field is not case sensitive. The parameter order is not defined, and parameter values must be quoted (with single quotes). NewLines, blackslashes, [ ] and single quotes must be escaped, e.g

@@continua[messageType name='test' value='This is a \nnew line and I am \'quoted\' by a\\b'] 


Message Types

message - Sends a message to to the build log. 

Parameters: value, status (debug, information, success, warning, error, fatal)

Example: 

@@continua[message value='This will be logged' status='information']


startGroup - Starts a message group (tree node) in the build log.

Parameters: name

Example: 

@@continua[startGroup name='Copying Files...']


endGroup
 - Ends a message group (tree node) in the build log

Parameters: name

Example: 

@@continua[endGroup name='Copying Files...']


setBuildVariable
(or setVariable) - Sets the value of a Continua CI build variable. 

Parameters: 

Examples: 

@@continua[setBuildVariable name='allowupload' value='true']
@@continua[setBuildVariable name='possiblyUnDefinedVariable' value='Hello world!' skipIfNotDefined='true']
@@continua[setBuildVariable name='counter' value='1' appendOrIncrement='true']
@@continua[setBuildVariable name='counter' regExPattern='v([\d]*)\.([\d]*)\.([\d]*)\.([\d]*)' replacement='version $1.$2.$3 with build number $4']



setServerVariable - Sets the value of a Continua CI server variable (Configuration, Project or Application variable)

Parameters: 

Examples: 

@@continua[setServerVariable name='allowupload' value='true']
@@continua[setServerVariable name='possiblyUnDefinedVariable' value='Hello world!' skipIfNotDefined='true']
@@continua[setServerVariable name='counter' value='1' appendOrIncrement='true' updateBuildVariable='true' updateAgentVariable='true' keepBuildWriteLock='true']
@@continua[setServerVariable name='counter' regExPattern='v([\d]*)\.([\d]*)\.([\d]*)\.([\d]*)' replacement='version $1.$2.$3 with build number $4' keepBuildWriteLock='truė' releaseLockOnStageEnd='true']


If another build has a lock on the server variable then the setServerVariable message will fail. Due to the one-way nature of custom log message, we cannot pause the running process to respond and retry. We recommend that you use the Acquire Variable Lock action to ensure that you own a lock on the variable before running process which use this message


loadVariable - Loads the current value of a server variable into the build variable. 

Parameters: 

Example: 

@@continua[loadVariable name='buildCounter1']
@@continua[loadVariable name='possiblyUnDefinedVariable' skipIfNotDefined='true']
@@continua[loadVariable name='version' skipAgentVariable='true' acquireBuildWriteLock='truė' releaseLockOnStageEnd='true']

If another build has a lock on the server variable and the acquireBuildWriteLock parameter is true then the loadVariable message will fail. Due to the one-way nature of custom log message, we cannot pause the running process to respond and retry. We recommend that you use the Acquire Variable Lock action to ensure that you own a lock on the variable before running process which use this message


acquireVariableLock - Acquires a write lock on a server variable so that no other builds can modify the value of the server variable until the lock is released, either at the end of the build or by another action

Parameters: 

Example: 

@@continua[acquireVariableLock name='buildCounter1' releaseLockOnStageEnd='true' ]

If another build has a lock on the server variable then the acquireVariableLock message will fail and log an error. Due to the one-way nature of custom log message, we cannot pause the running process to respond and retry. We recommend that you only use this message if you are sure no other builds can hold a lock on the variable, e.g. after acquiring a shared resource lock.


releaseVariableLock - Releases any a write lock on a server variable acquired by the current build. A warning will be logged if the current build does not hold a lock on the variable.

Parameters: 

Example: 

@@continua[releaseVariableLock name='buildCounter1' ]


setBuildVersion - Sets the current build's version string. 

Parameters:  value, verbose

Example: 

@@continua[setBuildVersion value='1.2.3']


setBuildStatus 
- Sets the current action's build status, which is shown on the build details page when a build is running.

Parameters: name, verbose

Example: 

@@continua[setBuildStatus value='Copying Files...']

pinBuild - Pins the current build, so that it is listed at the top of the build history and excluded from build cleanup. Optionally provide a comment to be associated with the pin and set the appendComment attribute to 'true' to append it to any existing comment.

Parameters: comment, appendComment, verbose

Example: 

@@continua[pinBuild comment='Keep this awesome build' appendComment='true']

unpinBuild - Removes any pins from the current build.

Parameters: verbose

Example : 

@@continua[unpinBuild]

tagBuild - Adds the supplied tag to the current build. Optionally set the replaceExisting attribute to 'true' to remove any existing tags first.

Parameters: tag, replaceExisting, verbose

Example: 

@@continua[tagBuild tag='deployed' replaceExisting='true']

removeBuildTag - Remove a tag or all tags from current build. Either provide the name of the tag to remove or set the removeAll attribute to 'true' to remove all existing tags.

Parameters: tag, removeAll, verbose

Examples: 

@@continua[removeBuildTag tag='deployed']

@@continua[removeBuildTag removeAll='true']

addBuildComment- Adds the supplied comment to the current build. Optionally set the replaceExisting attribute to 'true' to remove any existing comments first.

Parameters: comment, replaceExisting, verbose

Example: 

@@continua[addBuildComment comment='This build was deployed to staging' replaceExisting='true']

importUnitTestResults - Imports unit tests and totals from unit test result files and registers them with the server. 

Parameters: 

Example: 

@@continua[importUnitTestResults type='nunit' filePatterns='C:\pathto\tests\**.xml|C:\another\pathto\tests\**.xml' failIfTestFails='false' failIfTestErrors='false' quiet='false' verbose='false']

Common parameters

If the verbose parameter is set to true for any of the message types above, additional text describing the action will be written to the build log.

Example : 

@@continua[setBuildVersion value='1.2.3' verbose='true']