Uncodemy Logo ← Back to Course
Jenkins · Topic 11 of 15

Jenkins Pipeline: Concepts & Types

What is a Jenkins Pipeline?

A Jenkins Pipeline is a combination of plugins that support integrating and implementing continuous delivery pipelines. A pipeline is essentially a group of events interlinked in a sequence, written using Groovy syntax.

Three Types of Pipelines

  1. Freestyle pipeline — built through manual, GUI-driven options; considered the older approach.
  2. Scripted pipeline — Groovy-based, more flexible/low-level scripting style.
  3. Declarative pipeline — a newer, more structured and readable syntax; this is what most real projects use today.

Scripted Pipeline Syntax Example

node {
    stage("stage 1") {
        echo "hi"
    }
}

Declarative Pipeline Syntax Example

pipeline {
    agent any
    stages {
        stage("code") {
            steps {
                echo "hi"
            }
        }
    }
}

Declarative syntax is the one used across all the real pipeline examples in this course.

Anatomy of a Declarative Pipeline

Creating Your First Pipeline Job

  1. From the Dashboard: New Item → select "Pipeline" → OK.
  2. Under the Pipeline tab, write your Groovy script (indentation is applied automatically — a tab or 4 spaces).
  3. Save, then click Build. The GUI switches to a Stage View showing each stage's execution step by step.
  4. Click on a stage's Logs to see its console output.

Multi-Stage Example

pipeline {
    agent any
    stages {
        stage("code") {
            steps { echo "hello" }
        }
        stage("build") {
            steps { sh 'cal 10 2023' }
        }
        stage("deploy") {
            steps {
                sh '''
                touch file
                uptime
                uname
                '''
            }
        }
    }
}

Master Jenkins & DevOps with Uncodemy

Hands-on live training, real projects, and placement support — become job-ready in DevOps.

Enroll in DevOps Training →