What is a Jenkins declarative pipeline and where is it defined?
⚡
Quick Answer
A structured pipeline defined in a Jenkinsfile (in the repo) using the pipeline { } block with stages and steps.
Detailed Answer
The declarative syntax (pipeline, agent, stages, stage, steps, post) is opinionated and readable, versus the flexible-but-verbose scripted (Groovy) pipeline. Storing the Jenkinsfile in the repo makes CI config code-reviewed and versioned alongside the app — 'pipeline as code'.
Code Example
pipeline {
agent any
stages {
stage('Build') { steps { sh 'make' } }
}
}💡
Interview Tip
Contrast declarative (structured) vs scripted (Groovy) pipelines.
jenkinspipelinejenkinsfile