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

default parameter values are ignored when triggering parameterized build from groovy post-build script

      Steps to reproduce:

      1. create job Foo with two string parameters: MAJOR, with default value '1', MINOR, with default value '0'
      2. create job Bar with a groovy post-build hook thus:

        def params = []
        params.push( new StringParameterValue( 'MINOR', 2 ) )
        def foo = manager.hudson.getJob( 'Foo' )
        foo.scheduleBuild( 2, new Cause.UpstreamCause( manager.build ), new ParametersAction( params ) )
      

      3. build Bar

      Expected Result:

      Foo builds with parameter values MAJOR=1, MINOR=2

      Actual Result:

      Foo build with parameter values MINOR=2

      If MAJOR isn't specified in the parameter list when invoking the build, it should use the default value in Foo's configuration. Instead, the parameter isn't evaluated at all.

          [JENKINS-13768] default parameter values are ignored when triggering parameterized build from groovy post-build script

          evilchili created issue -

          cjo9900 added a comment -

          This occurs with the Parametrised trigger as well so it is core issue in that declared parameters are not enforced to be present. This is caused because the script and Parametrised trigger both call scheduleBuild() directly without the ParametersDefinitionProperty handling the starting parameters, as would occur if doBuild() or buildWithParameters() is called.

          cjo9900 added a comment - This occurs with the Parametrised trigger as well so it is core issue in that declared parameters are not enforced to be present. This is caused because the script and Parametrised trigger both call scheduleBuild() directly without the ParametersDefinitionProperty handling the starting parameters, as would occur if doBuild() or buildWithParameters() is called.

          cjo9900 added a comment -

          Pull request for a potential fix submitted

          https://github.com/jenkinsci/jenkins/pull/553

          cjo9900 added a comment - Pull request for a potential fix submitted https://github.com/jenkinsci/jenkins/pull/553

          Axel Heider added a comment -

          Ran into the same issue with V1.513. Would really like to see this implemented.

          Axel Heider added a comment - Ran into the same issue with V1.513. Would really like to see this implemented.

          Eldad Assis added a comment -

          @cjo9900 - any news on your suggested fix? I looked at the code change and it looks good to me. Is there a way to push this?

          Eldad Assis added a comment - @cjo9900 - any news on your suggested fix? I looked at the code change and it looks good to me. Is there a way to push this?
          ikedam made changes -
          Component/s New: core [ 15593 ]
          Component/s Original: parameterized-trigger [ 15592 ]
          Assignee Original: huybrechts [ huybrechts ]
          Issue Type Original: Bug [ 1 ] New: Improvement [ 4 ]

          Larry Archer added a comment -

          I've run into this issue as well, when trying to use the Bitbucket pull request builder plugin. That plugin sets its own parameters in scheduleBuild, so the parameters I set up for the project are not present at all on builds triggered by the plugin.

          Larry Archer added a comment - I've run into this issue as well, when trying to use the Bitbucket pull request builder plugin . That plugin sets its own parameters in scheduleBuild , so the parameters I set up for the project are not present at all on builds triggered by the plugin.
          Jesse Glick made changes -
          Link New: This issue is related to SECURITY-170 [ SECURITY-170 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-30178 [ JENKINS-30178 ]
          Daniel Beck made changes -
          Link New: This issue is related to JENKINS-31897 [ JENKINS-31897 ]

            wolfs Stefan Wolf
            evilchili evilchili
            Votes:
            5 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: