• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • Workflow 1.11
      Jenkins 1.625.2

      When triggering a parameterized job using a build step, default parameters values are not honored when explicitly setting the value of at least one parameter.

      To reproduce it:

      1. Create a parameterized Workflow job (call it "paramd-job"), with 2 string parameters: A, with default value "A" and B with default value "B" and script echo A; echo B
      2. Trigger paramd-job from a second Workflow job using: build job: 'paramd-job', parameters: [[$class: 'StringParameterValue', name: 'A', value: 'Custom value']]

      Expected: paramd-job triggered with A="Custom value" and B="B", both values printed in the build log.
      Actual: B is not defined. groovy.lang.MissingPropertyException: No such property: B for class: WorkflowScript

          [JENKINS-31897] Default parameter value is not used

          Antonio Muñiz created issue -
          Antonio Muñiz made changes -
          Assignee Original: Jesse Glick [ jglick ] New: Antonio Muñiz [ amuniz ]

          Jesse Glick added a comment -

          It is a longstanding open question in Jenkins who is supposed to handle default parameter values and to what extent they are guaranteed to be defined. There is no overall policy or enforced mechanism.

          Jesse Glick added a comment - It is a longstanding open question in Jenkins who is supposed to handle default parameter values and to what extent they are guaranteed to be defined. There is no overall policy or enforced mechanism.
          Daniel Beck made changes -
          Link New: This issue is related to JENKINS-13768 [ JENKINS-13768 ]

          Agree. So let's assume that no overall policy is defined and just force a policy in Workflow.
          AFAICT we can "force" the default value for undefined parameter values in the incoming JSONArray.fromObject(parameter) here.

          Antonio Muñiz added a comment - Agree. So let's assume that no overall policy is defined and just force a policy in Workflow. AFAICT we can "force" the default value for undefined parameter values in the incoming JSONArray.fromObject(parameter) here .
          Antonio Muñiz made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Antonio Muñiz made changes -
          Remote Link New: This issue links to "PR 269 (Web Link)" [ 13587 ]

          Pull request sent.

          Antonio Muñiz added a comment - Pull request sent.
          Jesse Glick made changes -
          Link New: This issue is related to SECURITY-170 [ SECURITY-170 ]

          Code changed in jenkins
          User: Antonio Muñiz
          Path:
          support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStepExecution.java
          http://jenkins-ci.org/commit/workflow-plugin/c24fd075742ef5034015dec9bed1a28c6cccb5f9
          Log:
          JENKINS-31897 Set default parameters if needed

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Muñiz Path: support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/c24fd075742ef5034015dec9bed1a28c6cccb5f9 Log: JENKINS-31897 Set default parameters if needed

            amuniz Antonio Muñiz
            amuniz Antonio Muñiz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: