Internet Explorer is no longer supported. Many things will still work, but your experience will be degraded and some things won't function. Please use a modern browser such as Edge, Chrome, or Firefox.

Built-in Functions & Variables

Modified on July 26, 2024

Applications

Builds

  • $ArtifactPath(ArtifactName, [buildNumber], [releaseNumber], [applicationName]) - gets the path within the internal disk store for the specified artifact
  • @ArtifactsInBuild([buildNumber], [releaseNumber], [applicationName]) - list of all the artifacts in the current or specified build
  • $Branch([BuildNumber], [ReleaseNumber], [ApplicationName]) - Git branch for the current or specified build
  • $BuildMasterId(Page, [ApplicationName], [ReleaseNumber], [BuildNumber]) - Gets the internal ID of the specified page.
  • $BuildMasterUrl(Page, [ApplicationName], [ReleaseNumber], [BuildNumber]) - Gets the URL of the specified page.
  • $BuildNumber([releaseNum], [furthestOrLatest], [appName]) - build number of the current or specified release
  • @BuildsInRelease([ReleaseNumber], [ApplicationName], [Status], [PipelineStage]) - Gets a list of builds in a release, optionally filtered by status and pipeline stage.
  • BuildVariable(VariableName, [BuildNumber], [ReleaseNumber], [ApplicationName]) - Gets the value of a variable defined on a build.
  • $CIBuild([BuildNumber], [ReleaseNumber], [ApplicationName]) - Identifier of the build imported from a CI server for the current or specified BuildMaster build
  • $CIBuildNumber([BuildNumber], [ReleaseNumber], [ApplicationName]) - Number of the build imported from a CI server for the current or specified BuildMaster build
  • $CIProject([BuildNumber], [ReleaseNumber], [ApplicationName]) - Name of the CI Project resource imported from a CI server for the current or specified BuildMaster build
  • $CIProjectScope([BuildNumber], [ReleaseNumber], [ApplicationName]) - Name of the CI Project scope (e.g. Jenkins Branch, TeamCity BuildConfiguration) associated with the current or specified build
  • $Commit([BuildNumber], [ReleaseNumber], [ApplicationName]) - Git commit hash for the current or specified build
  • $DockerRepository([BuildNumber], [ReleaseNumber], [ApplicationName]) - Docker Repository for the current or specified build
  • $DockerTag([BuildNumber], [ReleaseNumber], [ApplicationName]) - Most recently associated Docker tag associated with the Docker Repository on the current or specified build
  • $PullRequestId([BuildNumber], [ReleaseNumber], [ApplicationName]) - Most recent pull request created for the current or specified build
  • $Repository([BuildNumber], [ReleaseNumber], [ApplicationName]) - Git repository name the current or specified build

Configuration Files

Containers

  • $ContainerDigest(repositoryName, [tag], [sourceName]) - Gets the digest of a Docker image. The digest is from the image associated with the current build.
  • @ContainersInBuild([repositoryName]) - Gets a list of Docker images in the current build. Each returned element is a map: %(Name: SomeName, Tag: 1.2.3, Digest: sha1:3924abbeeea2162, Repository: repositoryName)
  • $ContainerTag(repositoryName, [sourceName]) - Gets the tag of the specified Docker image associated with the current build.

Credentials

Databases

Deployables

  • @DependentApplications([appName]) - list of applications which import at least one deployable from the specified application
  • @DependentReleases(appName) - list of active or deployed releases from the specified application with at least one deployable imported from the current release of the current application
  • $DeployableName([depName], [releaseNum]) - name of the current deployable in context
  • @DeployablesInRelease([appName], [releaseNum], [includeImported]) - list of deployables included in the specified release, or the current release in context
  • $ReferencedApplicationName([depName], [releaseNum]) - application name referenced by the current or specified deployable
  • $ReferencedPackageNumber([depName], [releaseNum], [furthestOrLatest]) - build number referenced by the current or specified deployable
  • $ReferencedReleaseName([depName], [releaseNum]) - release name of the current deployable in context
  • $ReferencedReleaseNumber([depName], [releaseNum]) - release number of the current deployable in context

Environments

Executions

  • $ExecutionId - Returns the current execution ID.
  • $ExecutionState - Returns the current state of the execution (normal, warning, or error).
  • $ExecutionUser - user name that initiated the current execution
  • GetVariableValue(VariableName, [VariableType]) - Returns the value of a variable if the specified variable name is available in the current context; otherwise returns null.
  • $IsReexecution - true if the current execution is a redeployment
  • $IsRollback - true if a build from an earlier release is redeployed to a stage
  • $IsVariableDefined(VariableName, [VariableType]) - Returns true if the specified variable name is available in the current context; otherwise returns false.
  • $WorkingDirectory - Returns the current working directory.

Files

  • $DirectoryExists(name) - Returns "true" if the specified directory exists on the current server.
  • $FileContents(name, [maxLength]) - Returns the contents of a file on the current server.
  • $FileExists(name) - Returns "true" if the specified file exists on the current server.
  • @FilesOnDisk(includes, [excludes], [directory]) - Returns a list of files matching the mask on the current server.
  • $PathCombine(Path1, Path2, ...) - Returns a string containing all of the arguments combined into a complete path.
  • $ResolvePath(Path) - Provides an absolute path (terminated with directory separator) based on a relative path and the current working directory; this will provide appropriate directory separators, based on the server in context

General

  • $AzPath - Returns the full path to the Azure CLI for the server in context.
  • $Date([Format]) - Returns the current date and time of the local timezone in the specified .NET datetime format string, or ISO 8601 format (yyyy-MM-ddTHH:mm:ss) if no format is specified.
  • $DateUtc([Format]) - Returns the current UTC date and time in the specified .NET datetime format string, or ISO 8601 format (yyyy-MM-ddTHH:mm:ss) if no format is specified.
  • $DevEnvPath - Full path to devenv.exe. This is usually similar to C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exeIf no value is supplied, the operation will use vswhere to determine the path to the latest installation of Visual Studio
  • Eval(Text) - Performs variable substitution and function evaluation for arbitrary text.
  • $JqlValue(Value) - (no description
  • $MSBuildToolsPath - The directory of the MSBuild tools, typically in 'C:\Program Files (x86)\MSBuild\{ToolsVersion}\Bin'; if empty, the MSBuildToolsPath registry value under SOFTWARE\Microsoft\MSBuild\ToolsVersions will be used.
  • $PromotionComments([StageName], [BuildNumber], [ReleaseNumber], [ApplicationName]) - Returns the comments for the specified promotion, or the promotion in the current context if values are not specified.
  • @Range(Start, Count) - Returns a range of integers starting from a specified value.
  • $SpecialWindowsPath(Name) - Returns the full path of a special directory on a Windows system.
  • $VsTestExePath - The full path to vstest.console.exe; if empty will attempt to resolve the path automatically.

JSON

  • FromJson(json) - Converts JSON to an OtterScript value.
  • $JSEncode(Text) - Encodes a string for use in a JavaScript string literal.
  • $ToJson(data) - Converts an OtterScript value to JSON.

Linux

  • $SHEval(ScriptText) - Returns the output of a shell script.

Lists

  • @ListConcat(...) - Creates a list containing the contents of each list in sequence.
  • $ListCount(List) - Count the number of elements in a list.
  • $ListIndexOf(List, Item) - Finds the index of an item in a list. Finding the first item in a list returns 0, and finding an item not present in the list returns -1.
  • @ListInsert(List, Item, [Index]) - Inserts an item into a list.
  • ListItem(List, Index) - Gets an item from a list.
  • @ListRemove(List, Index) - Removes an item from a list.

Maps

  • MapAdd(Map, Key, Value) - Adds a key-value pair to a map.
  • MapItem(Map, Key) - Gets an item from a map.
  • @MapKeys(Map) - Lists the keys of a map.
  • MapRemove(Map, Key) - Removes a key from a map.

Math

  • $Abs(value) - Returns the absolute value of a number.
  • $Ceiling(value) - Returns the value rounded up to the nearest integer.
  • $Compare(Arg1, Operator, Arg2, [AsNumber]) - Compare two values numerically or as case-sensitive strings.
  • $Decrement(value, [amount]) - Returns a string that contains the result of decrementing a value.
  • $Expr(expression) - Evaluates a mathematical expression using +, -, *, /, or % operators.
  • $Floor(value) - Returns the value rounded down to the nearest integer.
  • $Increment(value, [amount]) - Returns a string that contains the result of incrementing a value.

Nuget

  • $NuGetExePath - The path to the nuget.exe client. When not specified, the included nuget.exe client is used.

Packages

  • $PackageHash(packageName, [sourceName]) - Gets the hex-encoded SHA1 hash of a package. The hash is from the version of the package associated with the current build.
  • $PackageProperty(packageName, packageProperty, [sourceName]) - Gets a value from the metadata of a package. The property is from the version of the package associated with the current build.
  • @PackagesInBuild([packageSource]) - Gets a list of packages in the current build. Each returned element is a map: %(Name: SomeName, Version: 1.2.3, PackageSource: SourceName)
  • $PackageVersion(packageName, [part], [sourceName]) - Gets the version of the specified package associated with the current build.

Pipelines

PowerShell

  • $PreferWindowsPowerShell - When true, the script will be run using Windows PowerShell 5.1 where available. When false or on Linux (or on Windows systems without PowerShell 5.1 installed), the script will be run using PowerShell Core instead.
  • $PSCredential(UserName, [Password]) - Returns a PSCredential object that can be passed to PowerShell scripts.
  • PSEval(ScriptText) - Returns the result of a PowerShell script.

Python

Releases

  • $CompareReleaseSequence(operator, releaseNum1, [releaseNum2]) - compares the release number of the current application with a specified release number
  • $IncrementReleaseNumber(lastReleaseNumber, [releaseNumberScheme]) - Returns the next release number that would be assigned.
  • $PreviousReleaseNumber([ReleaseNumber], [ApplicationName]) - release number of the last deployed release, relative to the specified or current release
  • $ReleaseName([ReleaseNumber], [ApplicationName]) - name of the current or specified release
  • $ReleaseNumber - release number of the current release, or "0.0.0" if no release number is in context
  • $ReleaseNumberPart(Part, [ReleaseNumber]) - a part (major, minor, build, revision) of the current or specified release number
  • ReleaseVariable(VariableName, [ReleaseNumber], [ApplicationName]) - Gets the value of a variable defined on a release.

Servers

  • @AcquiredServers(Role) - list of all of the servers acquired for a specified role
  • @AllEnvironments - Returns a list of all environments.
  • @AllRoles - Returns a list of all server roles.
  • @AllServers([IncludeInactive]) - Returns a list of all servers.
  • $EnvironmentVariable(EnvironmentVariableName) - Returns the value of the specified environment variable on the current server.
  • $RoleName - name of the current server role in context
  • $ServerName - name of the current server in context
  • @ServersInEnvironment([EnvironmentName], [IncludeInactive]) - Returns a list of all the servers in the specified environment name.
  • @ServersInRole([RoleName], [IncludeInactive]) - Returns a list of servers in the specified role.
  • @ServersInRoleAndEnvironment([RoleName], [EnvironmentName], [IncludeInactive]) - Returns a list of all the servers in the specified role and environment name.

Strings

  • $Coalesce(...) - Returns the first argument which does not contain only whitespace.
  • $HtmlEncode(Text) - Encodes a string for use in HTML.
  • $Join(Separator, Values) - Concatenates all elements of a list into a string using a specified separator.
  • $JSEncode(Text) - Encodes a string for use as a JavaScript literal.
  • $MatchesRegex(Text, RegexPattern) - Returns true when the specified text matches the specified pattern; otherwise returns false.
  • $NewLine([WindowsOrLinux]) - newline string for either the operating system of the current server in context or specifically Windows or Linux
  • $PadLeft(Text, Length, [PadCharacter]) - Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified character, for a specified total length.
  • $PadRight(Text, Length, [PadCharacter]) - Returns a new string that left-aligns the characters in this instance by padding them on the left with a specified character, for a specified total length.
  • @RegexFind(Text, MatchExpression, [MatchGroup]) - Finds all matches of a regular expression in a string, optionally returning only a matched group.
  • $RegexReplace(Text, MatchExpression, ReplaceWith) - Searches for and replaces text in a string using a regular expression.
  • $Replace(Text, Value, ReplaceWith, [IgnoreCase]) - Searches for and replaces text in a string.
  • @Split(Text, Separator, [Count]) - Splits a string into substrings based on a specified separator.
  • $Substring(Text, Offset, [Length]) - Returns a segment of another string.
  • $ToLower(Text) - Returns a string with all letters converted to lowercase.
  • $ToUpper(Text) - Returns a string with all letters converted to uppercase.
  • $Trim(Text, ...) - Returns a string with all leading and trailing whitespace characters removed, or optionally a set of specified characters.
  • $TrimEnd(Text, ...) - Returns a string with all trailing whitespace characters removed, or optionally a set of specified characters.
  • $TrimStart(Text, ...) - Returns a string with all leading whitespace characters removed, or optionally a set of specified characters.
  • $UrlEncode(Text) - Escapes a string for use in a URL.

XML

  • $XmlEncode(Text) - Encodes a string for use in an XML element.