What is Jenkins Declarative vs Scripted Pipeline?

Updated Apr 28, 2026

Short answer

Declarative uses a strict, structured YAML-like syntax, while Scripted uses full Groovy code for complex logic.

Deep explanation

Declarative pipelines are easier to read, enforce a specific structure (pipeline { stages { ... } }), and natively support pre/post-build actions. Scripted pipelines (node { ... }) give you maximum programmatic flexibility to write loops, try/catch blocks, and advanced logic directly in the pipeline.

Real-world example

Standardizing CI/CD across 50 microservices using a clean Declarative pipeline template stored in a Jenkinsfile.

Common mistakes

  • Writing overly complex Java/Groovy business logic inside a Scripted pipeline instead of putting that logic in a dedicated bash/python script.

Follow-up questions

  • Where should the Jenkinsfile be stored?

More DevOps interview questions

View all →