Stages Collection

Used by Build object. Represents the collection of stages in the parent object (i.e. build) and includes functions to select stages in that collection. The stages are sorted by running order.

Properties

Name Description Return Type Usage Example
Count Returns number of stages in the collection Integer $Build.Stages.Count$ 3

Functions

Name and Parameters Description Return Type Usage Example
First() Gets first stage from the collection Stage $Build.Stages.First().Name$ "Build"
First(string property, string operator, string value, bool ignoreCase) Gets first matching stage from the collection for given property using given operator. See list of valid operators below. Stage $Build.Stages.First("IsFailure", Equals, True).AgentName$ "ciagent01"
IsEmpty() Returns true if collection is empty. Boolean $Build.Stages.IsEmpty()$ False
Item(integer index) Gets a stage in the collection by zero-based index number Stage $Build.Stages.Item(1).Name$ "Test"
Last() Gets last stage from the collection Stage $Build.Stages.Last().Name$ "Deploy"
Last(string property, string operator, string value, bool ignoreCase) Gets last matching stage from the collection for given property using given operator. See list of valid operators below. Stage $Build.Stages.Last("IsSuccessful", Equals, True).Finished$ "13/11/2018 01:35:03"
Select(string property) Returns a string collection of property values String Collection $Build.Stage.Select(Name).Join(",")$ "Build, Test, Deploy"
Where(string property, string operator, string value, bool ignoreCase) Gets matching stages from collection for given property using given operator. See list of valid operators below. Stages Collection $Build.Stages.Where("HasWarnings", Equals, True).Count$ 2

Operators

  • Equals
  • DoesNotEqual
  • Contains
  • DoesNotContain
  • StartsWith
  • DoesNotStartWith
  • EndsWith
  • DoesNotEndWith
  • IsRegexMatch
  • IsNotRegexMatch