Jenkins Pipeline Generator
Generate production-ready Jenkinsfiles using modern Declarative Pipeline syntax or advanced Scripted Pipeline.
How to Write a Jenkinsfile
What is a Jenkinsfile?
A Jenkinsfile is a text file that contains the definition of a Jenkins Pipeline and is checked into source control. It allows you to model your deployment pipeline as code (Pipeline-as-Code).
Declarative vs. Scripted Pipeline
Jenkins supports two different syntax paradigms:
#
Declarative Pipeline is a more recent and advanced addition to Jenkins. It provides a more structured, simpler, and highly opinionated syntax. It enforces a strict block structure (e.g., pipeline, agent, stages, steps, post).
#
Scripted Pipeline is the traditional way to write Jenkinsfiles. It is essentially a full-fledged Groovy script executed inside Jenkins.
node block.Key Concepts
agent directive is placed.stage block defines a conceptually distinct subset of tasks performed through the entire pipeline (e.g. "Build", "Test", "Deploy"). A step is a single task.post section defines actions that will run at the end of the pipeline or a stage. Common use cases include sending notifications or cleaning up the workspace.