• Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • Jenkins ver. 2.73.1
      job-dsl-plugin 1.65

      There are often failures when users input string parameter with an extra space.
      This leads to build failures in many cases.

      It would be great to be able to trim string parameter from the beginning. So it can be safely used everywhere down in the pipeline:

      parameters {
              string(defaultValue: "", description: '', name: 'tag or commit', trim: true)
      }
      

          [JENKINS-47115] Add trim option to String Parameter

          The string parameter in Jenkins has no trim option. Job DSL only provides syntax for options that are available in Jenkins core or plugins.

          Daniel Spilker added a comment - The string parameter in Jenkins has no trim option. Job DSL only provides syntax for options that are available in Jenkins core or plugins.

          Comment above does not resolve the problem described.

          Moving to core.

          Alexander Vorobiev added a comment - Comment above does not resolve the problem described. Moving to core.

          Will try this one

          Carlos Tadeu Panato added a comment - Will try this one

          PR #3106

          Kseniia Nenasheva added a comment - PR  #3106

          aborting this since ks_nenasheva already did

          Carlos Tadeu Panato added a comment - aborting this since ks_nenasheva already did

          Code changed in jenkins
          User: Kseniia Nenasheva
          Path:
          core/src/main/java/hudson/model/StringParameterDefinition.java
          core/src/main/java/hudson/model/StringParameterValue.java
          core/src/main/resources/hudson/model/StringParameterDefinition/config.jelly
          core/src/main/resources/hudson/model/StringParameterDefinition/index.jelly
          war/src/main/webapp/help/parameter/trim.html
          http://jenkins-ci.org/commit/jenkins/95db56e850f13650d3b16bec7a07f0abe20a931a
          Log:
          JENKINS-47115 - Add trim option to String Parameter (#3106)

          • Add help information
          • Address comments
          • Address comments
          • Address comments
          • Address comments

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kseniia Nenasheva Path: core/src/main/java/hudson/model/StringParameterDefinition.java core/src/main/java/hudson/model/StringParameterValue.java core/src/main/resources/hudson/model/StringParameterDefinition/config.jelly core/src/main/resources/hudson/model/StringParameterDefinition/index.jelly war/src/main/webapp/help/parameter/trim.html http://jenkins-ci.org/commit/jenkins/95db56e850f13650d3b16bec7a07f0abe20a931a Log: JENKINS-47115 - Add trim option to String Parameter (#3106) JENKINS-47115 - Add trim option to String Parameter Add help information Address comments Address comments Address comments Address comments

          Thanks a lot, Kseniia.

          Will trim be available in pipeline after the change above of does pipeline support need another Jira issue?

          Alexander Vorobiev added a comment - Thanks a lot, Kseniia. Will trim be available in pipeline after the change above of does pipeline support need another Jira issue?

          Oleg Nenashev added a comment -

          The improvement has been integrated towards 2.90

          Oleg Nenashev added a comment - The improvement has been integrated towards 2.90

          Felipe Santos added a comment -

          Felipe Santos added a comment - Documentation is not updated so.  https://www.jenkins.io/doc/book/pipeline/syntax/#parameters

          Wen Zhou added a comment - - edited

          Good to have document updated https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.BuildParametersContext.stringParam


          Never mind, I understand it now, this is a dynamic DSL, therefore not showing in the dsl API or links above.

          Wen Zhou added a comment - - edited Good to have document updated  https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.BuildParametersContext.stringParam Never mind, I understand it now, this is a dynamic DSL, therefore not showing in the dsl API or links above.

            ks_nenasheva Kseniia Nenasheva
            vorobievalex Alexander Vorobiev
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: