What does `milestone` do?
AdvancedConceptDeclarative pipeline syntax
Answer
milestone(ordinal) ensures builds pass a point in order: when a newer build passes milestone N, older builds that have not yet reached N are aborted. Combined with input it prevents an old build from being approved and deploying over a newer one.
milestone(1)
input 'Deploy?'
milestone(2)
In declarative pipelines, disableConcurrentBuilds(abortPrevious: true) covers the common case more simply.
More on Declarative pipeline syntax
What is the minimum valid declarative pipeline?BeginnerWhat agent types exist in declarative pipelines?IntermediateWhen do you use `agent none` at the top level?IntermediateHow do nested sequential stages work and why are they useful?IntermediateList the `post` conditions and when each fires.IntermediateWhat are the most useful `when` conditions?Intermediate