Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-15920

Boolean parameter becomes string

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I have a boolean parameter in my job. It is shown as a checkbox on the job 'parameters' page.

      When I trigger this job via the Parameterized Trigger plug-in, I set the parameter the following way:
      NIGHTLY=true

      As a result, the triggered job has the word "true", not the checkbox. See screenshots attached.

        Attachments

          Activity

          Hide
          cjo9900 cjo9900 added a comment -

          As you use the predefined parameters option which only creates StringParameterValues.
          This is due to the fact that it does not know any thing related to the triggered jobs, so does not match parameter types at all.

          Note that downstream job should not have an issue as the boolean parameter is exposed as an Env variable as KEY=true/false.

          The display of the Parameter in the triggered job is done via the parameter type passed to it not from what is configured from the job.

          The only solution to this would be to implement a Boolean Parameter for the parameterized trigger plugin that passes boolean parameters.

          Show
          cjo9900 cjo9900 added a comment - As you use the predefined parameters option which only creates StringParameterValues. This is due to the fact that it does not know any thing related to the triggered jobs, so does not match parameter types at all. Note that downstream job should not have an issue as the boolean parameter is exposed as an Env variable as KEY=true/false. The display of the Parameter in the triggered job is done via the parameter type passed to it not from what is configured from the job. The only solution to this would be to implement a Boolean Parameter for the parameterized trigger plugin that passes boolean parameters.
          Hide
          cjo9900 cjo9900 added a comment -
          Show
          cjo9900 cjo9900 added a comment - Added pull request for boolean parameters https://github.com/jenkinsci/parameterized-trigger-plugin/pull/32
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: cjo9900
          Path:
          src/main/java/hudson/plugins/parameterizedtrigger/BooleanParameterConfig.java
          src/main/java/hudson/plugins/parameterizedtrigger/BooleanParameters.java
          src/main/resources/hudson/plugins/parameterizedtrigger/BooleanParameterConfig/config.jelly
          src/main/resources/hudson/plugins/parameterizedtrigger/BooleanParameters/config.jelly
          src/main/resources/hudson/plugins/parameterizedtrigger/BooleanParameters/help-configs.html
          http://jenkins-ci.org/commit/parameterized-trigger-plugin/0a66ecaf22c143a982c3a6a1c3c3ffd13fd7bd41
          Log:
          [FIXED JENKINS-15920] Add boolean parameter option

          Add a parameter item to allow boolean parameters
          to be passed to down stream jobs

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: cjo9900 Path: src/main/java/hudson/plugins/parameterizedtrigger/BooleanParameterConfig.java src/main/java/hudson/plugins/parameterizedtrigger/BooleanParameters.java src/main/resources/hudson/plugins/parameterizedtrigger/BooleanParameterConfig/config.jelly src/main/resources/hudson/plugins/parameterizedtrigger/BooleanParameters/config.jelly src/main/resources/hudson/plugins/parameterizedtrigger/BooleanParameters/help-configs.html http://jenkins-ci.org/commit/parameterized-trigger-plugin/0a66ecaf22c143a982c3a6a1c3c3ffd13fd7bd41 Log: [FIXED JENKINS-15920] Add boolean parameter option Add a parameter item to allow boolean parameters to be passed to down stream jobs
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: cjo9900
          Path:
          src/main/java/hudson/plugins/parameterizedtrigger/BooleanParameterConfig.java
          src/main/java/hudson/plugins/parameterizedtrigger/BooleanParameters.java
          src/main/resources/hudson/plugins/parameterizedtrigger/BooleanParameterConfig/config.jelly
          src/main/resources/hudson/plugins/parameterizedtrigger/BooleanParameters/config.jelly
          src/main/resources/hudson/plugins/parameterizedtrigger/BooleanParameters/help-configs.html
          http://jenkins-ci.org/commit/parameterized-trigger-plugin/af93a4194fc21edf49fa64bae287d9aa9f84d214
          Log:
          Merge branch 'JENKINS-15920' of git://github.com/cjo9900/parameterized-trigger-plugin into 2.17-RC

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: cjo9900 Path: src/main/java/hudson/plugins/parameterizedtrigger/BooleanParameterConfig.java src/main/java/hudson/plugins/parameterizedtrigger/BooleanParameters.java src/main/resources/hudson/plugins/parameterizedtrigger/BooleanParameterConfig/config.jelly src/main/resources/hudson/plugins/parameterizedtrigger/BooleanParameters/config.jelly src/main/resources/hudson/plugins/parameterizedtrigger/BooleanParameters/help-configs.html http://jenkins-ci.org/commit/parameterized-trigger-plugin/af93a4194fc21edf49fa64bae287d9aa9f84d214 Log: Merge branch ' JENKINS-15920 ' of git://github.com/cjo9900/parameterized-trigger-plugin into 2.17-RC
          Hide
          akom Alexander Komarov added a comment -

          FYI this is still a problem with Parameterized Trigger 2.35.2 and Jenkins 2.98 ... Same result.

          If I trigger via a job with Predefined parameters, I get a string:

          If I trigger the job directly, I get a boolean.

          Show
          akom Alexander Komarov added a comment - FYI this is still a problem with Parameterized Trigger 2.35.2 and Jenkins 2.98 ... Same result. If I trigger via a job with Predefined parameters, I get a string: If I trigger the job directly, I get a boolean.
          Hide
          cabmendes Carlos Baia Mendes added a comment -

          Workaround:

          Boolean.valueOf(string_variable) or the oposite String.valueOf(boolean_variable)

          Show
          cabmendes Carlos Baia Mendes added a comment - Workaround: Boolean.valueOf(string_variable) or the oposite String.valueOf(boolean_variable)

            People

            • Assignee:
              cjo9900 cjo9900
              Reporter:
              alex01ves Alex Vesely
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: