Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

For the list of expressions available for version 1.9.1 of Continua CI see Expression Objects.

What are they?

Expressions are a mechanism for the autocompletion of objects whose values which may not be known until build execution time (for example the current build number).  They can also be used to autocomplete variables.


Where can I use them?

Expressions can be utilised in several dialogue dialog fields throughout Continua (they are especially useful within stage actions, and build event handlers).  

The expansion icon (below) denotes fields that have expression capabilities. Note is some areas, such as configuration variables, you can click on this icon to disable expressions

 

Expression Expansion

To initiate n an expansion, simply type the dollar symbol '$' and the expression auto complete will present (note: not all objects are available in all fields).

 


Image Added


Table of Contents
minLevel3

Anchor
workspace
workspace

...

$Workspace

NameDescriptionTypeUsage Examples
N/A
The disk location (on the server or agent)
Represents the full path of a
builds
build's workspace folder.
string
String$Workspace$\testfolder"D:\ContinuaAgent\Ws\19\"


Anchor
build
build
$Build

NameDescriptionTypeUsage
Examples
Example
IdA unique Integer allocated automatically to this buildString$Build.Id$"10"
Version
The
A reference object for the build version
. This is derived from the configuration 'Version Format String' field on the configuration details tab
(as defined below).Version$Build.Version$N/A
version$Build.Version.Default.Major$
StartedByThe username of the user who initiated the buildString$Build.StartedBy$"peter.toms@finalbuilder.com"
IsFeatureBranchBuild
Utilized
Utilised via build triggers
, this descriptor
. This expression is set to true when a build is triggered on a non-default branchBoolean$Build.IsFeatureBranchBuild$true
BuildNumber
The total number of buildsNumeric
A zero-based auto-incremented integer allocated to this build (the first build will be build 0, the second build 1, etc)Integer$Build.BuildNumber$100
MetricsA
placeholder for metrics related to
reference object to the metrics associated with this build (
eg the number of unit tests passed)
as defined below).Metrics$Build.Metrics$N/A
HasNewChangesDoes this build contain
any new Changesets (which Continua has not yet seen)
changesets which have not been associated with a previous build?Boolean
boolean
$Build.HasNewChanges$true
LinkUrlBuild details
Url (eg
URLString$Build.LinkUrl$"http:\\SERVERNAME\New_Project_1\ci\builds\view\123
)String$Build.LinkUrl$
" 


Anchor
configuration
configuration
$Configuration

NameDescriptionTypeUsage Examples
NameName of the
Configuration
configuration (as defined
on
within the Configuration
Details Page
details page)String$Configuration.Name$"New Configuration 1"
RunningBuildsThe number of currently running buildsInteger$Configuration.RunningBuilds$1
QueuedBuildsThe number of currently queued buildsInteger$Configuration.QueuedBuilds$1
InitialisingBuildsThe number of currently initialising buildsInteger$Configuration.InitialisingBuilds$1


Anchor
agent
agent
$Agent

NameDescriptionTypeUsage
Examples
Example
PortThe
Port
port number used for agent communicationString$Agent.Port$"9000"
HostnameThe
Agents Hostname
agents host nameString$Agent.Hostname$"AGENTMACHINE"
NowThe current date and time given as local to the agent
local
datetime
DateTime$Agent.Now$"2014 4:51:44 PM"
NowUTCThe
Date
current date and
Time
time given as UTC
datetime
DateTime$Agent.NowUtc$"2014 6:52:25 AM"
InstallPathThe installation path of the agent
(eg C:\ContinuaAgentInstall)
String$Agent.InstallPath$
GetUserEnvironmentVairable
"C:\Program Files\VSoft Technologies\ContinuaCIAgent\"
GetUserEnvironmentVariableGets the specified Windows user environment variable (relative to the agent machine's service user, and relative to the agent machine)String$Agent.
GetUserEnvironmentVairable
GetUserEnvironmentVariable("TEMP")$
GetMachineEnvironmentVairable
"%USERPROFILE%\AppData\Local\Temp"
GetMachineEnvironmentVariableGets the specified
Machine Environment Variable
Windows machine environment variable (relative to the agent machine) String$Agent.
GetMachineEnvironmentVairable
GetMachineEnvironmentVariable("NUMBER_OF_PROCESSORS")$"8"
N/A
What follows
Within the Agent object is a list of the current agent property collectorsProperty Collector$Agent.NuGet.Default.Path$"C:\Program Files\NuGet\NuGet.exe"


Anchor
project
project
$Project

NameDescriptionTypeUsage
Examples
Example
NameThe name of
the Project for which this
the project the current configuration is a part of (as
Provided
provided on the Project
Details
details page)String$Project.
Name.ToLower$
Name$"New Project 1"
DescriptionThe description of the
Project for which this
project the current configuration is a part of (as
Provided
provided on the Project
Details
details page)String$Project.
Description.ToLower$
Description$"This is a description for new project 1"
SlugA
shorterned
shortened version of the project name which is safe to use within
Url's
URLs and other whitespace sensitive identifiers
. For example "New Project 1" would have a slug of "New
.String$Project.Slug$"New_Project_1"


Anchor

...

source
source

...

$Source

NameDescriptionTypeUsage
Examples
Example
N/AA
List of the repositories associated with configurationWhat follows is a
list of repositories associated with the
given
current configurationRepository$Source.Reponame$"Mercurial_Test_1"


Anchor
server
server
$Server

NameDescriptionTypeUsage
Examples
Example
NowThe current date and time given as local to the server
local
DateTime$Server.
Now.Day$
Now$"01/01/2014 5:03:18 PM"
NowUtcThe date and time given as UTCDateTime$Server.
NowUtc.Month$
NowUtc$"01/01/2014 7:04:01 AM"
HostnameThe Continua server hostnameString$Server.
Hostname.ToLower$
Hostname$"SERVERMACHINE"
InstallPathThe Continua server install path
(eg
String$Server.InstallPath$"C:\Program Files\VSoft
\)
Technologies\ContinuaCI\"
UrlThe web service URLString$Server.
InstallPath.ToLower$UrlThe Server URL (eg http://ContinuaServerName)String$Server.Url.ToLower$
Url$"http:\\SERVERNAME:8080"


Anchor
utils
utils
$Utils

NameDescriptionTypeUsage
Examples
Example
NewGuidCreate a new randomly generated
Guid
GUIDGuid$Utils.NewGuid$"da47b2d6-3580-48ed-b27a-f152da2345e6"
RandomNumber

Generate a new random integer value

If one parameter is provided it designates a random number in the range of greater than or equal to zero and the number provided will be generated

If two parameters are provided they designate the range for the generated number.

If no parameters are provided

an

a 32-bit integer greater than or equal to zero and less than

int32

Int32 max value (2,147,483,647) will be generated.

DateTime
Integer

$Utils.RandomNumber("1", "10")$

$Utils.RandomNumber("10")$

$Utils.RandomNumber$

5

2

1906529119 


Anchor
repository
repository
Repository (used by $Source )

NameDescriptionTypeUsage
Examples
Example
Branch
 
The full name of the branch associated with the build for the given repositoryString$Source.RepoName.
Branch.ToLower$
Branch$"/branches/a_test_branch"
BranchNameThe branch name of the branch associated with the build for the given repository
BranchName 
String$Source.RepoName.BranchName
.ToLower$
$"a_test_branch"
BuiltChangesetA reference object to the changeset information related to the changeset which is being built for the given repository (as defined below)Changeset$Source.RepoName.BuildChangeset.TagNames$"tag1,tag2,tag3"
CommitsSinceLatestTagThe number of commits listed in the changeset history for the current branch of the given repository since the latest tagInteger$Source.RepoName.CommitsSinceLatestTag$3
LatestChangesetA reference object to the changeset information related to the most recent changeset for the given repository (as defined below).
LatestChangeset 
Changeset$Source.RepoName.LatestChangeset.Comment$
Path 
"a comment from the last commit"
LatestTagNameThe latest tag name (if one exists) listed in the changeset history for the current branch of the given repositoryString$Source.RepoName.LatestTagName$"tag3"
LatestTriggeringChangesetA reference object to the changeset information related to the latest changeset for the given repository which triggerred this build (as defined below)Changeset
String
$Source.RepoName.BuildChangeset.BranchName$"master"
Path
.ToLower$Tag
The disk location of the source associated with the build for the given repositoryString$Source.RepoName.Path$"C:\ContinuaAgent\Ws\44\Source\"
TagThe tag name (if one exists) associated with the build for the given repository
 
String$Source.RepoName.
Tag.ToLower$
Tag$"v3-release"
Type
 
The repository product being usedString$Source.RepoName
a.Type$
.Type$"Mercurial"
Url
 
The URL of the repository in question (as defined within the repository preferences)String$Source.RepoName.Url$"https://github.com/VSoftTechnologies/Delphi-Mocks.git"


Anchor
changeset
changeset
Changeset (used by $Source)

NameDescriptionTypeUsage
Examples
Example
Id
 
A unique identifier given to this changesetString$Source.RepoName.BuiltChangeset.Id$"a4ae66dffe5342e47c3aaf987bced4e9a320559e"
Comment
 
This comment associated with this changesetString$Source.RepoName.BuiltChangeset.Comment$
Repositoryusername
"This is a test commit"
RepositoryUsernameThe username of the repository user who committed this changeset
 
String$Source.RepoName.BuiltChangeset.
Repositoryusername
RepositoryUsername$"Peter Toms"
Branch
 
The full branch path of the latest changeset associated with this repositoryString$Source.RepoName.BuiltChangeset.Branch$
Branchname
"/branches/a_test_branch"
BranchNameThe branch name of the latest changeset associated with this repository
 
String$Source.RepoName.BuiltChangeset.
Branchname
BranchName$"a_test_branch"
$
Created
 Datetime
The date and time when the changeset was committed or created within the source repositoryDateTime$Source.RepoName.BuiltChangeset.Created
$Filecount Int
$"11/09/2014 1:48:36 AM"
FileCountThe number of file changes associated with this commitInteger$Source.RepoName.BuiltChangeset.FileCount$1
CommitterUserNameThe username of the Continua User who committed this changeset (if one exists based on user repository mappings )String$Source.RepoName.BuiltChangeset.CommitterUserName$"peter.toms@finalbuilder.com"
CommitterFullNameThe full name of the Continua user who committed this changeset (if one exists based on user repository mappings)String$Source.RepoName.BuiltChangeset.CommitterFullName$"Peter Toms"
FirstTagNameThe name of the first (or earliest) tag associated with this changesetString$Source.RepoName.BuiltChangeset.FirstTagName$"tag1"
LatestTagNameThe name of the latest tag associated with this changesetString$Source.RepoName.
Filecount
BuiltChangeset.LatestTagName$
Committerusername
"tag3"
TagNamesA comma-delimited list of tags associated with this changeset
 
String$Source.RepoName.BuiltChangeset.
Committerusername$Committerfullname
TagNames$"tag1,tag2,tag3"
ChangedTagNameThe name of the tag which was changed by this changeset
 
String$Source.RepoName.LatestTriggeringChangeset.
Committerfullname$
ChangedTagName$"tag3"


Anchor
stage
stage
Stage (used by

...

$Build)

NameDescriptionTypeUsage
ExamplesName   Metrics   
Example
NameThe stage name as defined within the workflow editorString$Build.Stage.Name"this is a test stage"
MetricsA reference object to the metrics associated with this build (as defined below).Metrics$Build.Stage.MetricsN/A


Anchor
metrics
metrics
Metrics (used by $Build)

NameDescriptionTypeUsage
ExamplesCompiler   Unit Tests   

...

Example
Compiler.WarningThe total number of compiler warnings for the current build (eg MSBuild or Visual Studio build warnings)Integer$Build.Metrics.Compiler.Warning$5
Compiler.ErrorThe total number of compiler errors for the current build (eg MSBuild or Visual Studio build errors)Integer$Build.Metrics.Compiler.Error$5
UnitTestsA reference object for the unit test metric details (as defined below)UnitTests$Build.Metrics.UnitTestsN/A


Anchor
unittests
unittests
UnitTests (used by $Build.Metrics)

NameDescriptionTypeUsage Example
FixtureCountThe total number of test fixturesInteger$Build.Metrics.UnitTests.FixtureCount$5
CaseCountThe total number of test casesInteger$Build.Metrics.UnitTests.CaseCount$5
PassedThe number of passed testsInteger$Build.Metrics.UnitTests.Passed$10
FailedThe number of failed testsInteger$Build.Metrics.UnitTests.Failed$5
ErrorThe number of tests in errorInteger$Build.Metrics.UnitTests.Error$1
NotRunThe number of tests not runInteger$Build.Metrics.UnitTests.NotRun$1
InconclusiveThe number of inconclusive testsInteger$Build.Metrics.UnitTests.Inconclusive$1
IgnoredThe number of ignored testsInteger$Build.Metrics.UnitTests.Ignored$1
InvalidThe number of invalid testsInteger$Build.Metrics.UnitTests.Invalid$1
SkippedThe number of skipped testsInteger$Build.Metrics.UnitTests.Skipped$1


Anchor
version
version
Version (used by $Build.Version)

NameDescriptionTypeUsage Example
DefaultA reference object for the default versionDefault$Build.Version.DefaultN/A
DotNetA reference object for the .Net versionDotNet$Build.Version.DotNetN/A


Anchor
default
default
Default (used by $Build.Version.Default)

NameDescriptionTypeUsage Example
MajorThe version major portion of the version numberInteger$Build.Version.Default.Major$"1" (given "1.2.3.4")
MinorThe version minor portion of the version numberInteger$Build.Version.Default.Minor$"2" (given "1.2.3.4")
BuildThe version build portion of the version numberInteger$Build.Version.Default.Build$"3" (given "1.2.3.4")
RevisionThe version revision portion of the version numberInteger$Build.Version.Default.Revision$"4" (given "1.2.3.4")


Anchor
dotnet
dotnet
DotNet (used by $Build.Version.DotNet)

NameDescriptionTypeUsage
Examples
Example
Major
   Minor   Build   Revision   

 

The version major portion of the version numberInteger$Build.Version.DotNet.Major$"1" (given "1.2.0.1287")
MinorThe version minor portion of the version numberInteger$Build.Version.DotNet.Minor$"2" (given "1.2.0.1287")
BuildThe version build portion of the version numberInteger$Build.Version.DotNet.Build$"0" (given "1.2.0.1287")
RevisionThe version revision portion of the version numberInteger$Build.Version.DotNet.Revision$"1287" (given "1.2.0.1287")


Anchor
dotnet
dotnet
General Functions (used by DateTime and String objects)

NameDescriptionTypeUsage Examples
FormatFormats a date or time value using standard or custom .Net formatting stringsString$Server.Now.Format("hh:mm")$"23:55" (given the date time "31/12/2000 23:55:333")
ToLowerConverts a string to lowercaseString$Source.RepoName.Branch.ToLower$"version 1.5" (given "Version 1.5")
ToUpperConverts a string to uppercaseString$Project.Name.ToUpper$"PROJECT X" (given "Project X")
TrimRemoves all leading and trailing occurrences of whitespace or the characters in the string providedString

$Build.Version.Trim$

$Build.Version.Trim(".,")$

"a b c d" (given " a b c d  ")

"a.b.c.d" (given ",a.b.c.d.")

ReplaceReplaces all occurrences of the first specified string in the current string with the second specified stringString$Configuration.Name.Replace("v.", "version" )$"Test Config version 10" (given "Test Config v. 10")

...