What is the minimum valid declarative pipeline?
BeginnerConceptDeclarative pipeline syntax
Answer
A pipeline block with an agent, a stages block containing at least one stage, and each stage containing steps (or nested stages, parallel or matrix).
pipeline {
agent any
stages {
stage('Build') {
steps { sh 'echo hello' }
}
}
}
Missing agent fails with Missing required section "agent".
More on Declarative pipeline syntax
What 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?IntermediateWhat do `beforeAgent`, `beforeInput` and `beforeOptions` do inside `when`?Advanced