What agent types exist in declarative pipelines?
IntermediateConceptDeclarative pipeline syntax
Answer
| Type | Meaning |
|---|---|
agent any |
Any available executor |
agent none |
No global agent; each stage declares its own |
agent { label 'linux && docker' } |
Node matching the expression |
agent { node { label 'linux'; customWorkspace '/data/ws/app' } } |
Label plus options |
agent { docker { image 'maven:3.9-eclipse-temurin-21'; args '-v m2:/root/.m2' } } |
Run steps inside a container on a Docker-capable node |
agent { dockerfile { filename 'ci/Dockerfile' } } |
Build and use an image from the repo |
agent { kubernetes { yamlFile 'ci/pod.yaml'; defaultContainer 'maven' } } |
Pod via the kubernetes plugin |
More on Declarative pipeline syntax
What is the minimum valid declarative pipeline?BeginnerWhen 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