5

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?

3
  • why is your job failing ?
    – Rsf
    Jun 18, 2019 at 13:20
  • When i leave some spaces in parameter value its getting failed.
    – Naik
    Jun 19, 2019 at 3:12
  • 1
    ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
    – Naik
    Jun 19, 2019 at 3:13

2 Answers 2

5

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

1
  • Thanks its working...
    – Naik
    Jun 21, 2019 at 7:05
2

You can use the trim parameter:

string(name: 'some parameter', trim: true)
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.