6

I am using jenkins pipeline job with parameters. when i had any trailing spaces in parameter value the job gets failed. is there any way to trim the spaces in pipeline job to avoid build failure?

Naik
  • 101
  • 2
  • 2
  • 5

2 Answers2

6

Use the Groovy trim() method. For instance, def myTrimmedParam = params.myParam.trim().

jayhendren
  • 2,952
  • 7
  • 15
4

You can use the trim parameter:

string(name: 'some parameter', trim: true)
Jay Prall
  • 143
  • 3