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

specifying a cli parameter causes unspecified parameters to be blank

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      If you have a parameterized job with multiple parameters, all with default values, you can trigger it via an upstream build and all parameters have the default value as expected. This also works when building it via the CLI if you don't specify parameters.

      However as soon as you specify one parameter like "-p PARAM1=foo" then all the other parameters lose their default value and are blank for the build.

      I would expect that specifying one parameter should still allow others to get the default, otherwise in our scripts that invoke CLI builds, we have to put in every parameter and duplicate the default value which is error-prone and is easy to forget when changing one. Confirmed with a fresh and clean 1.370 Hudson.

        Attachments

          Issue Links

            Activity

            Hide
            cjo9900 cjo9900 added a comment -

            Pull request PULL 540 added to fix this.[1]

            Add all the job defined Parameters to the ParameterAction using Defaults
            if not passed via the command line.

            If this breaks backwards compatibility where these are not expected to be passed, we can introduce a new option to use the defaults for parameters which triggers this behaviour.

            @Option(name="-d",usage="Use defaults for parameters not specified, only valid when -p is used")
            public boolean parameterDefaults = false;

            [1] https://github.com/jenkinsci/jenkins/pull/540

            Show
            cjo9900 cjo9900 added a comment - Pull request PULL 540 added to fix this. [1] Add all the job defined Parameters to the ParameterAction using Defaults if not passed via the command line. If this breaks backwards compatibility where these are not expected to be passed, we can introduce a new option to use the defaults for parameters which triggers this behaviour. @Option(name="-d",usage="Use defaults for parameters not specified, only valid when -p is used") public boolean parameterDefaults = false; [1] https://github.com/jenkinsci/jenkins/pull/540
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: c3johnso
            Path:
            core/src/main/java/hudson/cli/BuildCommand.java
            test/src/test/groovy/hudson/cli/BuildCommandTest.groovy
            http://jenkins-ci.org/commit/jenkins/7e0d7c0acba504b8bd205cdb228346bbfa09ddfa
            Log:
            [FIXED JENKINS-7162] Add missing parameters as defaults when called from CLI

            Add all the job defined Parameters to the ParameterAction using Defaults
            if not passed via the command line.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: c3johnso Path: core/src/main/java/hudson/cli/BuildCommand.java test/src/test/groovy/hudson/cli/BuildCommandTest.groovy http://jenkins-ci.org/commit/jenkins/7e0d7c0acba504b8bd205cdb228346bbfa09ddfa Log: [FIXED JENKINS-7162] Add missing parameters as defaults when called from CLI Add all the job defined Parameters to the ParameterAction using Defaults if not passed via the command line.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: vjuranek
            Path:
            core/src/main/java/hudson/cli/BuildCommand.java
            test/src/test/groovy/hudson/cli/BuildCommandTest.groovy
            http://jenkins-ci.org/commit/jenkins/0ddceed69f86e1e32281561873483c4dbc6ee4dd
            Log:
            Merge pull request #540 from cjo9900/JENKINS-7162

            [FIXED JENKINS-7162] Add missing parameters as defaults when called from...

            Compare: https://github.com/jenkinsci/jenkins/compare/c14c7619c615...0ddceed69f86

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: vjuranek Path: core/src/main/java/hudson/cli/BuildCommand.java test/src/test/groovy/hudson/cli/BuildCommandTest.groovy http://jenkins-ci.org/commit/jenkins/0ddceed69f86e1e32281561873483c4dbc6ee4dd Log: Merge pull request #540 from cjo9900/ JENKINS-7162 [FIXED JENKINS-7162] Add missing parameters as defaults when called from... Compare: https://github.com/jenkinsci/jenkins/compare/c14c7619c615...0ddceed69f86
            Hide
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #1856
            [FIXED JENKINS-7162] Add missing parameters as defaults when called from CLI (Revision 7e0d7c0acba504b8bd205cdb228346bbfa09ddfa)

            Result = UNSTABLE
            chris.3.johnson : 7e0d7c0acba504b8bd205cdb228346bbfa09ddfa
            Files :

            • core/src/main/java/hudson/cli/BuildCommand.java
            • test/src/test/groovy/hudson/cli/BuildCommandTest.groovy
            Show
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #1856 [FIXED JENKINS-7162] Add missing parameters as defaults when called from CLI (Revision 7e0d7c0acba504b8bd205cdb228346bbfa09ddfa) Result = UNSTABLE chris.3.johnson : 7e0d7c0acba504b8bd205cdb228346bbfa09ddfa Files : core/src/main/java/hudson/cli/BuildCommand.java test/src/test/groovy/hudson/cli/BuildCommandTest.groovy
            Hide
            jmechler Jason Mechler added a comment -

            Would love to see this backported to LTS.

            Show
            jmechler Jason Mechler added a comment - Would love to see this backported to LTS.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              mcrooney mcrooney
              Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: