#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 13 of 15

Pipeline Parameters (String, Boolean, Choice)

By Uncodemy Editorial Team · Updated 16 Nov 2026

Why parameters

A parameter is a value the person (or script) starting the build chooses at that moment: which branch to build, which environment to deploy to, whether to run the slow tests. In a Freestyle job you add them through "This project is parameterized" (see Jenkins build parameters). In a pipeline you declare them in code, in a parameters block, so they are versioned with the Jenkinsfile.

One Jenkinsfile with all three types

pipeline {
    agent any
    parameters {
        string(name: 'BRANCH', defaultValue: 'main', description: 'Git branch to build')
        booleanParam(name: 'RUN_E2E', defaultValue: false, description: 'Run the slow browser tests?')
        choice(name: 'TARGET', choices: ['qa', 'staging', 'prod'], description: 'Where to deploy')
    }
    stages {
        stage('Checkout') {
            steps {
                git branch: params.BRANCH, url: 'https://github.com/example/student-portal.git'
            }
        }
        stage('Unit tests') {
            steps { sh 'npm ci && npm test' }
        }
        stage('E2E tests') {
            when { expression { params.RUN_E2E } }
            steps { sh 'npx playwright test' }
        }
        stage('Deploy') {
            steps {
                echo "Deploying ${params.BRANCH} to ${params.TARGET}"
                sh './deploy.sh "$TARGET"'
            }
        }
    }
}

Read values with params.NAME in Groovy. Jenkins also exposes each parameter as an environment variable, so the shell can use $TARGET.

What you see in the UI

  1. After the first run, the job's left menu shows Build with Parameters instead of "Build Now".
  2. Clicking it opens a form: a text box "BRANCH" filled with main, an unticked checkbox "RUN_E2E", and a drop-down "TARGET" showing qa. Each field shows its description underneath.
  3. Choose values and click Build. With RUN_E2E unticked, the Stage View shows "E2E tests" as skipped.
  4. Open the build and click Parameters in its menu to see which values that run used.

Starting a parameterised build from outside

# from another pipeline
build job: 'student-portal', parameters: [
    string(name: 'BRANCH', value: 'release/2.1'),
    booleanParam(name: 'RUN_E2E', value: true),
    string(name: 'TARGET', value: 'staging')
]

# from a script, with a user's API token
curl -X POST -u ci-bot:API_TOKEN \
  "https://jenkins.example.com/job/student-portal/buildWithParameters?TARGET=qa&RUN_E2E=true"

More ways to trigger jobs are in triggering Jenkins jobs.

Traps and errors

Need a human to confirm a value in the middle of a run instead of at the start? Use the input step.

Master Jenkins & DevOps with Uncodemy

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

Enroll in DevOps Training →