Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trim parameters in Jenkins pipeline?

I am setting up a parameterized Jenkins job with pipeline. I need to trim trim parameters any suggestions?

In New version of Jenkins i can able to get the parameters. But I can't modify the parameters. If i use setValue(), it gives me unsupportedException.

like image 839
Learner Avatar asked Jan 21 '19 09:01

Learner


2 Answers

parameters {
        string(defaultValue: "", description: '', name: 'tag or commit', trim: true)
}
like image 100
Aakizone Avatar answered Oct 18 '22 04:10

Aakizone


Which type of parameter are You using? Is it user input or some kind of choice list? As workaround You can use another variable:

myVar = param1.trim() 

then You can use myVar instead o param1

like image 42
Robert Grądzki Avatar answered Oct 18 '22 04:10

Robert Grądzki