- Published on
Declarative vs. Imperative CI
- Authors

- Name
- Skim
Declarative Pipeline
This approach limits what you can do to some extent, but it does so for a good reason. Declarative pipelines are written in a concise, human-readable format, focusing on the "what" rather than the "how." They offer a structured and simplified way of defining CI/CD workflows.
Scripted/imperative Pipeline
In contrast, scripted pipelines give you more control. They allow you to write custom Groovy scripts to define your workflows. This flexibility can be powerful but comes at the cost of complexity.
Complexity vs. Simplicity
Declarative pipelines are recommended for most use cases due to their simplicity. They're easy to read, write, and maintain, making them suitable for straightforward CI/CD needs. Scripted pipelines, on the other hand, are more appropriate for complex, custom workflows.
Choosing the Right Approach
The right choice depends on your situation. Declarative pipelines are the go-to choice for straightforward projects -- they're easier to read and maintain since updates mostly involve editing configuration files. Teams with mixed experience levels tend to do better with them too.
Scripted pipelines make more sense when your workflows are complex and need fine-grained control or advanced scripting that declarative syntax can't express.
Source: https://medium.com/globant/jenkins-pipeline-declarative-vs-scripted-21f8688ee16a