You are currently viewing Jenkins pipeline part 8 – inputs

Jenkins pipeline part 8 – inputs

Jenkins pipeline part 8 – inputs

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In today’s blog post, we will discuss inputs in a Jenkins pipeline and how take input from user in Jenkins pipeline using inputs.

What is inputs is Jenkins pipeline?

The input directive on a stage allows you to prompt for input, using the input step. The stage will pause after any options have been applied, and before entering the agent block for that stage or evaluating the when condition of the stage. If the input is approved, the stage will then continue. Any parameters provided as part of the input submission will be available in the environment for the rest of the stage.

Inputs configuration options:

message:

Required. This will be presented to the user when they go to submit the input.

id:

An optional identifier for this input. Defaults to the stage name.

ok:

Optional text for the “ok” button on the input form.

submitter:

An optional comma-separated list of users or external group names who are allowed to submit this input. Defaults to allowing any user.

submitterParameter:

An optional name of an environment variable to set with the submitter name, if present.

parameters:

An optional list of parameters to prompt the submitter to provide.

Let’s dig down a bit one example.

Jenkins pipeline part 8 – inputs

Prerequisites

One system with Jenkins installed.

Create a new pipeline in your Jenkins controller server using below Jenkinsfile definition. Replace the label as per your Jenkins configuration.

Trigger the pipeline based on your project configuration.

If you now navigate to the pipeline job, you will observe the second stage is waiting for a user input. Provide the required input and start the pipeline.

Jenkins pipeline part 8 – inputs

Pipeline will get executed successfully if everything goes right.

Jenkins pipeline part 8 – inputs

Hope you have enjoyed this article, to get more details on Jenkins, please refer below Jenkins official documentation.

https://www.jenkins.io/doc/

Leave a Reply