#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
Jenkins · Topic 11 of 15

Jenkins Pipeline: Concepts & Types

By Uncodemy Editorial Team · Updated 16 Nov 2026

What a pipeline is

A Jenkins Pipeline is a build process written as code. Instead of clicking options into a job's configuration page, you describe the steps (check out, build, test, deploy) in a Groovy-based script, and Jenkins runs them in order, shows each stage on screen, and stops at the first failure. Because the script can live in your repository as a Jenkinsfile, the build is versioned and reviewed like the rest of the code.

Freestyle job, scripted pipeline, declarative pipeline

Older notes list "three types of pipeline". Strictly, Freestyle is a different job type, and a Pipeline job can be written in two syntaxes:

Freestyle jobScripted pipelineDeclarative pipeline
Defined inThe web UIGroovy codeGroovy code with a fixed structure
Starts withn/anode { ... }pipeline { ... }
Stored in GitNo (config lives on the server)Yes, as a JenkinsfileYes, as a Jenkinsfile
Syntax checks before runningn/aFewYes, structure is validated first
Typical useVery simple or legacy jobsComplex logic, loops, shared librariesMost new pipelines

Start with declarative. When you need full Groovy logic, you can still drop into a script { } block inside a declarative stage.

The blocks of a declarative Jenkinsfile

pipeline {
    agent any                          // where to run: any free agent

    options {
        timeout(time: 30, unit: 'MINUTES')
        buildDiscarder(logRotator(numToKeepStr: '20'))
    }

    stages {
        stage('Checkout') {
            steps { checkout scm }
        }
        stage('Build') {
            steps { sh 'npm ci' }
        }
        stage('Test') {
            steps { sh 'npm test' }
        }
        stage('Deploy to QA') {
            when { branch 'main' }     // only on the main branch (multibranch jobs)
            steps { sh './deploy.sh qa' }
        }
    }

    post {
        failure { echo "Build ${env.BUILD_NUMBER} failed" }
        always  { cleanWs() }          // needs the Workspace Cleanup plugin
    }
}

The same build in scripted syntax would start with node { stage('Build') { sh 'npm ci' } }: shorter for tiny jobs, but with no built-in structure or validation.

Creating a pipeline job (screen by screen)

  1. Dashboard → New Item → enter a name → choose Pipeline → OK.
  2. Scroll to the Pipeline section. To experiment, keep "Pipeline script" and paste the code into the box. For real projects, choose "Pipeline script from SCM", give the Git URL and branch, and leave Script Path as Jenkinsfile.
  3. Click Save, then Build Now.
  4. The job page shows each stage as a box: green for passed, red for failed. Click a box (or the build number → Console Output) to read the log.

The Pipeline Syntax link on the job page opens the snippet generator, which writes the code for any step you choose from a form. It is the quickest way to get the exact syntax for a plugin step.

Common errors

To try changes without committing, open a finished build and use Replay, which lets you edit the Jenkinsfile for one run. For a CI example with browser tests, see integrating Playwright with CI/CD tools.

Master Jenkins & DevOps with Uncodemy

Hands-on live training, real projects and Dedicated Placement Support — become job-ready in DevOps.

Enroll in DevOps Training →