What are Pipelines?
A Jenkins Pipeline is a series of steps that define your build, test, and deployment process. Instead of clicking around in a freestyle job, you write a script (Jenkinsfile) that Jenkins executes. Pipelines are the modern way to create CI/CD workflows in Jenkins.
A Pipeline is your entire automation process expressed as code, stored in a Jenkinsfile.
Why Use Pipelines?
- Code: Pipelines are stored in a text file (Jenkinsfile), versioncontrolled in Git.
- Durable: Pipelines survive Jenkins restarts.
- Visual: The Blue Ocean plugin and stage view show progress.
- Complex workflows: Conditional logic, parallel steps, and user input.
- Reusable: Share pipeline code across projects.
Two Types of Pipelines
- Declarative Pipeline: Newer, simpler syntax with a clear structure (preferred for most use cases).
- Scripted Pipeline: Older, more flexible Groovy scripting (for complex logic).
What Is a Jenkinsfile?
A Jenkinsfile is a text file containing the pipeline definition. It lives in your source code repository, so your build process travels with your code.
Minimal Declarative Pipeline example:
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
}
}Creating a Pipeline Job in Jenkins
1. Click "New Item", give it a name, select "Pipeline".
2. Under "Pipeline", define where the Jenkinsfile is: either "Pipeline script" (write inline) or "Pipeline script from SCM" (load from Git).
3. Save and click "Build Now".
Two Minute Drill
- Pipelines automate CI/CD as code in a Jenkinsfile.
- Declarative pipelines are simpler; scripted are more flexible.
- Jenkinsfiles can be stored in Git for version control.
- Pipeline jobs use the Jenkinsfile to run builds.
Need more clarification?
Drop us an email at career@quipoinfotech.com
