Skip to main content

Command Palette

Search for a command to run...

Part 9: Parameterized Pipelines

Scaling pipeline to accept Dynamic inputs

Published
3 min read
Part 9: Parameterized Pipelines

Jenkins CI/CD Series

Part Article
1 Install Jenkins with Docker
2 Creating Your First Jenkins Pipeline
3 Jenkins SSH Remote Execution
4 Automating MySQL Backup to AWS S3
5 Making Jenkins Automation Scalable
6 Running Ansible from Jenkins
7 Jenkins Pipeline from GitHub
8 Multibranch Pipelines
9 Parameterized Pipelines
10 Environment Variables in Pipelines

Goal

Create a Jenkins pipeline named parameter-pipeline that accepts user inputs through parameters to control a deployment configuration. The pipeline should allow the user to specify a custom deployment name, choose the target AWS Availability Zone, and confirm the deployment before execution.


Purpose

The purpose of this part is to make your Jenkins pipelines interactive, flexible, and production-ready.

So far, your pipelines were:

  • Static

  • Hardcoded

  • Same behavior for every run

In real-world DevOps:

  • Deployments vary by environment (Dev, UAT, Prod)

  • Infrastructure changes by region/AZ

  • Releases need manual confirmation or approvals

Parameterized pipelines solve this by:

  • Allowing user input during execution

  • Enabling controlled deployments

  • Reducing the need to modify pipeline code

This is a critical DevOps practice used in:

  • Multi-environment deployments

  • Release approvals

  • Dynamic infrastructure provisioning


Prerequisite

Before starting this part, ensure:

  • Ready to use Host and the directory structure to run Dockerfiles and docker-compose.yml (Refer to Part 1)

Step-by-step implementation

Here is the code that will be used

pipeline {
    agent any

    parameters {
        string(
            name: "deploymentName",
            defaultValue: "",
            description: "Deployment Name?"
        )

        choice(
            name: "azDeploy",
            choices: ["ap-southeast-1a", "ap-southeast-1b", "ap-southeast-1c"],
            description: "What AZ?"
        )

        booleanParam(
            name: "confirmDeploy",
            defaultValue: false,
            description: "CONFIRM DEPLOYMENT?"
        )
    }

    stages {
        stage("Deploy") {
            steps {
                echo "Deployment Name: ${params.deploymentName}"
                echo "AZ Selected: ${params.azDeploy}"
                echo "Deployment Confirmation: ${params.confirmDeploy}"
            }
        }
    }
}
  • Create Pipeline parameter-pipeline"
  • Add the script to the pipeline script
  • Build Now
  • Provide inputs and click build with parameters
  • Expected console output
  • Pipeline status

Done!!!


Conclusion

In this part, you transformed your pipeline into a dynamic, user-driven CI/CD system

We learned how to:

  • Accept user inputs directly from Jenkins UI

  • Control pipeline execution using parameters

  • Make deployments flexible and environment-aware

  • Reduce hardcoding in pipeline scripts

This is how real-world pipelines operate in production:

  • Same pipeline, multiple use cases

  • Controlled deployments with user validation

  • Better flexibility without changing code


🔗 Continue the Series

⬅️ Previous Article: Part 8 Multibranch Pipelines
➡️ Next Article: Part 10 Environment Variables in Pipelines


⭐ If you found this article useful, follow https://ask-abhi.com for more DevOps tutorials.