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

NameDescriptionReturn TypeUsage Example
CountReturns number of stages in the collectionInteger$Build.Stages.Count$3


Functions

Name and ParametersDescriptionReturn TypeUsage Example
First()Gets first stage from the collectionStage$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 numberStage$Build.Stages.Item(1).Name$"Test"
Last()Gets last stage from the collectionStage$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 valuesString 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


  • No labels