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

Jenkins CLI cannot handle arguments with equals signs ("=")

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • cli, remoting
    • None
    • stable-1.565.3

      The Jenkins CLI can pass in parameters to a parameterized build. It uses the "-p" option for this. The arguments are parsed using args4j. The version of args4j that has been incorporated has a bug in the MapOptionHandler code where it will not accept a parameter value that has an equals sign ("=") in it; instead it will take everything up to the equals sign. The problem appears to be fixed in newer args4j code.

          [JENKINS-21160] Jenkins CLI cannot handle arguments with equals signs ("=")

          Bob Bell created issue -

          Any help for an alternate fix for this, till we get issue to be in resolved status.

          Shyamendra Singh added a comment - Any help for an alternate fix for this, till we get issue to be in resolved status.

          Shyamendra Singh added a comment - seems this issue is fixed https://github.com/jenkinsci/jenkins/pull/776

          Damien Nozay added a comment -

          I'm having the issue with Jenkins 1.554.3 + args4j:args4j:2.0.23
          https://github.com/kohsuke/args4j/issues/87

          If it was fixed with args4j:args4j:2.0.23 then something else may be causing the problem.

          Damien Nozay added a comment - I'm having the issue with Jenkins 1.554.3 + args4j:args4j:2.0.23 https://github.com/kohsuke/args4j/issues/87 If it was fixed with args4j:args4j:2.0.23 then something else may be causing the problem.

          Damien Nozay added a comment -

          created a test job ("test-params") with "ARGS" as string parameter

          import hudson.cli.BuildCommand;
          import java.util.Locale;
          import java.io.ByteArrayOutputStream;
          import java.io.InputStream;
          import java.io.PrintStream;
          
          
          def test(parameter) {
              locale = Locale.ENGLISH;
              InputStream stdin;
              ByteArrayOutputStream out = new ByteArrayOutputStream();
              ByteArrayOutputStream err = new ByteArrayOutputStream();
              command = new BuildCommand();
              String[] args = ["test-params", "-p", parameter];
              returnCode = command.main(
                  args.toList(), locale, stdin, new PrintStream(out), new PrintStream(err)
              );
          }
          
          
          test("ARGS=a")
          test("ARGS=a=b")
          

          both run that were created had ARGS=a.

          Damien Nozay added a comment - created a test job ("test-params") with "ARGS" as string parameter import hudson.cli.BuildCommand; import java.util.Locale; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.PrintStream; def test(parameter) { locale = Locale.ENGLISH; InputStream stdin; ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); command = new BuildCommand(); String [] args = [ "test-params" , "-p" , parameter]; returnCode = command.main( args.toList(), locale, stdin, new PrintStream(out), new PrintStream(err) ); } test( "ARGS=a" ) test( "ARGS=a=b" ) both run that were created had ARGS=a.

          Damien Nozay added a comment -

          not able to repro from the stable-1.554.3 war with no plugins, but
          seeing this issue with stable-1.554.3 with the following plugins:

          (tools)-bash-4.1$ jenkins list-plugins
          antisamy-markup-formatter   AntiSamy Markup Formatter Plugin     1.0 (1.2)
          windows-slaves              Windows Slaves Plugin                1.0
          matrix-auth                 Matrix Authorization Strategy Plugin 1.1 (1.2)
          mailer                      Mailer Plugin                        1.8 (1.11)
          external-monitor-job        External Monitor Job Type Plugin     1.2
          ldap                        LDAP Plugin                          1.8 (1.10.2)
          pam-auth                    PAM Authentication plugin            1.1
          ant                         Ant Plugin                           1.2
          javadoc                     Javadoc Plugin                       1.1 (1.2)
          throttle-concurrents        Throttle Concurrent Builds Plug-in   1.8.2 (1.8.3)
          token-macro                 Token Macro Plugin                   1.10
          run-condition               Run Condition Plugin                 1.0
          multiple-scms               Multiple SCMs plugin                 0.3
          ownership                   Job and Slave ownership plugin       0.4 (0.5.1)
          publish-over-ssh            Publish Over SSH                     1.11
          maven-plugin                Maven Integration plugin             2.0.3 (2.6)
          patch-parameter             patch-parameter                      1.1 (1.2)
          next-build-number           Next Build Number Plugin             1.1
          conditional-buildstep       conditional-buildstep                1.3.3
          credentials                 Credentials Plugin                   1.10 (1.16.1)
          ssh-credentials             SSH Credentials Plugin               1.6.1 (1.9)
          promoted-builds             promoted builds plugin               2.17 (2.18)
          scm-api                     SCM API Plugin                       0.2
          git-client                  GIT client plugin                    1.8.0 (1.10.2)
          git                         GIT plugin                           2.2.1 (2.2.6)
          build-failure-analyzer      Build Failure Analyzer               1.7.0 (1.10.0)
          buildgraph-view             buildgraph-view                      1.1.1
          build-flow-plugin           CloudBees Build Flow plugin          0.12-SNAPSHOT (private-05/12/2014 16:30-damien) (0.15)
          build-flow-toolbox-plugin   Build Flow Toolbox                   0.1-SNAPSHOT (private-05/12/2014 15:23-damien) (0.1)
          ws-cleanup                  Workspace Cleanup Plugin             0.20 (0.24)
          ssh-slaves                  SSH Slaves plugin                    1.6 (1.7.1)
          log-parser                  Log Parser Plugin                    1.0.8
          secret                      Build Secret plugin                  1.7
          groovy-postbuild            Groovy Postbuild                     1.8 (2.0)
          subversion                  Subversion Plug-in                   2.2 (2.4.3)
          cvs                         CVS Plug-in                          2.11 (2.12)
          email-ext                   Email Extension Plugin               2.37.2.2 (2.38.2)
          view-job-filters            View Job Filters                     1.26
          postbuildscript             Post-Build Script Plug-in            0.16
          build-name-setter           build-name-setter                    1.3
          testlink                    TestLink Plugin                      3.10
          extensible-choice-parameter Extensible Choice Parameter plugin   1.2.2
          rebuild                     Rebuilder                            1.21 (1.22)
          htmlpublisher               HTML Publisher plugin                1.3
          copyartifact                Copy Artifact Plugin                 1.30 (1.31)
          translation                 Translation Assistance plugin        1.11
          greenballs                  Green Balls                          1.14
          artifactdeployer            Artifact Deployer Plug-in            0.28 (0.32)
          claim                       Claim Plugin                         2.3
          jenkins-reviewbot           jenkins-reviewbot                    1.4.2 (2.1.2)
          selected-tests-executor     Tests Selector                       1.3.3
          clone-workspace-scm         Clone Workspace SCM Plug-in          0.6
          versionnumber               Version Number Plug-In               1.4.1
          python                      Python Plugin                        1.2
          disk-usage                  disk-usage plugin                    0.23 (0.24)
          envinject                   Environment Injector Plugin          1.89 (1.90)
          cloudbees-folder            CloudBees Folders Plugin             4.2.1 (4.6.1)
          

          I will try to see which one is causing the issue.

          Damien Nozay added a comment - not able to repro from the stable-1.554.3 war with no plugins, but seeing this issue with stable-1.554.3 with the following plugins: (tools)-bash-4.1$ jenkins list-plugins antisamy-markup-formatter AntiSamy Markup Formatter Plugin 1.0 (1.2) windows-slaves Windows Slaves Plugin 1.0 matrix-auth Matrix Authorization Strategy Plugin 1.1 (1.2) mailer Mailer Plugin 1.8 (1.11) external-monitor-job External Monitor Job Type Plugin 1.2 ldap LDAP Plugin 1.8 (1.10.2) pam-auth PAM Authentication plugin 1.1 ant Ant Plugin 1.2 javadoc Javadoc Plugin 1.1 (1.2) throttle-concurrents Throttle Concurrent Builds Plug-in 1.8.2 (1.8.3) token-macro Token Macro Plugin 1.10 run-condition Run Condition Plugin 1.0 multiple-scms Multiple SCMs plugin 0.3 ownership Job and Slave ownership plugin 0.4 (0.5.1) publish-over-ssh Publish Over SSH 1.11 maven-plugin Maven Integration plugin 2.0.3 (2.6) patch-parameter patch-parameter 1.1 (1.2) next-build-number Next Build Number Plugin 1.1 conditional-buildstep conditional-buildstep 1.3.3 credentials Credentials Plugin 1.10 (1.16.1) ssh-credentials SSH Credentials Plugin 1.6.1 (1.9) promoted-builds promoted builds plugin 2.17 (2.18) scm-api SCM API Plugin 0.2 git-client GIT client plugin 1.8.0 (1.10.2) git GIT plugin 2.2.1 (2.2.6) build-failure-analyzer Build Failure Analyzer 1.7.0 (1.10.0) buildgraph-view buildgraph-view 1.1.1 build-flow-plugin CloudBees Build Flow plugin 0.12-SNAPSHOT ( private -05/12/2014 16:30-damien) (0.15) build-flow-toolbox-plugin Build Flow Toolbox 0.1-SNAPSHOT ( private -05/12/2014 15:23-damien) (0.1) ws-cleanup Workspace Cleanup Plugin 0.20 (0.24) ssh-slaves SSH Slaves plugin 1.6 (1.7.1) log-parser Log Parser Plugin 1.0.8 secret Build Secret plugin 1.7 groovy-postbuild Groovy Postbuild 1.8 (2.0) subversion Subversion Plug-in 2.2 (2.4.3) cvs CVS Plug-in 2.11 (2.12) email-ext Email Extension Plugin 2.37.2.2 (2.38.2) view-job-filters View Job Filters 1.26 postbuildscript Post-Build Script Plug-in 0.16 build-name-setter build-name-setter 1.3 testlink TestLink Plugin 3.10 extensible-choice-parameter Extensible Choice Parameter plugin 1.2.2 rebuild Rebuilder 1.21 (1.22) htmlpublisher HTML Publisher plugin 1.3 copyartifact Copy Artifact Plugin 1.30 (1.31) translation Translation Assistance plugin 1.11 greenballs Green Balls 1.14 artifactdeployer Artifact Deployer Plug-in 0.28 (0.32) claim Claim Plugin 2.3 jenkins-reviewbot jenkins-reviewbot 1.4.2 (2.1.2) selected-tests-executor Tests Selector 1.3.3 clone-workspace-scm Clone Workspace SCM Plug-in 0.6 versionnumber Version Number Plug-In 1.4.1 python Python Plugin 1.2 disk-usage disk-usage plugin 0.23 (0.24) envinject Environment Injector Plugin 1.89 (1.90) cloudbees-folder CloudBees Folders Plugin 4.2.1 (4.6.1) I will try to see which one is causing the issue.

          Daniel Beck added a comment -

          I'd start the search by getting rid of envinject, and maybe Token Macro.

          Daniel Beck added a comment - I'd start the search by getting rid of envinject, and maybe Token Macro.

          Damien Nozay added a comment -

          I set up another environment with the same plugins (and same plugin versions); I am not able to repro.
          the only thing i can think of is a botched upgrade (1.532.3 => 1.554.3)

          Damien Nozay added a comment - I set up another environment with the same plugins (and same plugin versions); I am not able to repro. the only thing i can think of is a botched upgrade (1.532.3 => 1.554.3)

          Damien Nozay added a comment -

          Ok, i just upgraded another system (1.532.3 => 1.565.3) and I am able to repro.
          I did remove envinject, and disabled token-macro.

          Damien Nozay added a comment - Ok, i just upgraded another system (1.532.3 => 1.565.3) and I am able to repro. I did remove envinject, and disabled token-macro.

          Daniel Beck added a comment -

          Did removing the plugins help, or did it make no difference? Your comment is unclear.

          Daniel Beck added a comment - Did removing the plugins help, or did it make no difference? Your comment is unclear.

            Unassigned Unassigned
            rjbell4 Bob Bell
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: