Course contentsShow
← Cloud and Infrastructure
Lesson 1788 of 2,98937. JenkinsFree lesson

Parameters and User Input

Accept user input through string, choice, boolean, and file parameters to customize pipeline runs.

Parameters and User Input

What you'll learn: How to make your Jenkins pipelines interactive by accepting user input at runtime through different parameter types.

Why Parameters Matter

Instead of hard-coding values like environment names, version numbers, or configuration choices into your pipeline, parameters let you customize each build run. Think of parameters as a form that appears before your pipeline starts — users fill it out, and those values flow into your build process.

Core Parameter Types

Jenkins supports several parameter types to match different input needs:

String parameters collect free-form text like version numbers or commit messages:

parameters {
    string(name: 'DEPLOY_ENV', defaultValue: 'staging', description: 'Target environment')
}

Choice parameters provide a dropdown of predefined options, ensuring valid selections:

parameters {
    choice(name: 'REGION', choices: ['us-east-1', 'eu-west-1'], description: 'AWS Region')
}

Boolean parameters offer simple yes/no toggles for feature flags:

parameters {
    booleanParam(name: 'RUN_TESTS', defaultValue: true, description: 'Execute test suite?')
}

File parameters let users upload configuration files or scripts:

parameters {
    file(name: 'CONFIG_FILE', description: 'Upload custom config')
}

Using Parameter Values

Access parameter values in your pipeline using params.PARAMETER_NAME:

stage('Deploy') {
    steps {
        echo "Deploying to ${params.DEPLOY_ENV}"
        sh "deploy.sh --region ${params.REGION}"
    }
}

Key Takeaway: Parameters transform static pipelines into flexible, interactive workflows by letting users provide runtime input through strings, choices, booleans, and files — making your automation adaptable without code changes.