Let’s take the example of String parameter.
Below pipeline snippet will help you to include the Straing parameter in jenkinsfile.
properties([ parameters([ string(name: 'DEPLOY_ENV', defaultValue: 'TESTING', description: 'The target environment') ]) ]) So, your jenkinsfile will be like:
properties([ parameters([ string(name: 'DEPLOY_ENV', defaultValue: 'TESTING', description: 'The target environment', ) ]) ]) pipeline { agent any stages { stage ("Example") { steps { script{ echo "Hello World" echo "${params.DEPLOY_ENV}" } } } } } Edit:
Using the below command, I triggered the jenkins job.
curl -vvv -u "xxx:xxxx" -X POST "http://xx.xxx.xxx.xxx:8080/job/test-param/buildWithParameters?DEPLOY_ENV=SOURAV" Output:
