# Part 9: Parameterized Pipelines

* * *

### Jenkins CI/CD Series

| Part | Article |
| --- | --- |
| 1 | [Install Jenkins with Docker](https://ask-abhi.com/part-1-install-jenkins-with-docker) |
| 2 | [Creating Your First Jenkins Pipeline](https://ask-abhi.com/part-2-creating-your-first-jenkins-pipeline) |
| 3 | [Jenkins SSH Remote Execution](https://ask-abhi.com/part-3-jenkins-ssh-remote-execution) |
| 4 | [Automating MySQL Backup to AWS S3](https://ask-abhi.com/part-4-automating-mysql-backup-to-aws-s3) |
| 5 | [Making Jenkins Automation Scalable](https://ask-abhi.com/part-5-making-jenkins-automation-scalable) |
| 6 | [Running Ansible from Jenkins](https://ask-abhi.com/part-6-running-ansible-from-jenkins) |
| 7 | [Jenkins Pipeline from GitHub](https://ask-abhi.com/part-7-control-jenkins-pipeline-through-github) |
| 8 | [Multibranch Pipelines](https://ask-abhi.com/part-8-multibranch-pipelines) |
| 9 | [Parameterized Pipelines](https://ask-abhi.com/part-9-parameterized-pipelines) |
| 10 | [Environment Variables in Pipelines](https://ask-abhi.com/part-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**](https://ask-abhi.com/part-1-install-jenkins-with-docker)**)**
    

* * *

### Step-by-step implementation

Here is the code that will be used

```typescript
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`**"**
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/19ab4202-af9a-4259-bb26-87f8ef7d7c93.png align="center")

*   **Add the script to the** `pipeline script`
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/d6a281e0-1ff9-4e2a-b01b-154533527444.png align="center")

*   **Build Now**
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/483c7115-129f-4f90-8bd0-c7d22ad617cb.png align="center")

*   **Provide inputs and <mark class="bg-yellow-200 dark:bg-yellow-500/30">click</mark>** `build with parameters`
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/da21cb7c-31a1-4380-8731-08c16a274827.png align="center")

*   **Expected** `console output`
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/c4a41512-e3d4-496e-9b66-06b2485334a9.png align="center")

*   **Pipeline status**
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/63257ee8-ea95-4ee2-900b-4ceecdb4c5f8.png align="center")

**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**](https://ask-abhi.com/part-8-multibranch-pipelines)  
➡️ **Next Article:** [Part 10 Environment Variables in Pipelines](https://ask-abhi.com/part-10-environment-variables-in-pipelines)

* * *

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

* * *
