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

Passing multiline text parameter to ant broken (windows)

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • ant-plugin
    • Win XP, Chrome.
      Windows 7, Firefox/IE

      A build configured to accept a Text Parameter and pass it to ant Ant build will fail if the user enters multiple lines in the text parameter field.

      For example, in the following output the parameter 'user.notes' is multiline:

      [workspace] $ cmd.exe /C '""C:\Program Files (x86)\ant\apache-ant-1.8.2\bin\ant.bat" "-Duser.notes=Optional notes

      For the keeping!" -Ddatabase.name=mm4_sit2 "-Ddatabase.fields=messages.

      {transactionreference, meridianmessagetype, queue}

      , meridianerrors.

      {errorkey}

      " -Ddatabase.host=dbhost db-capture && exit %%ERRORLEVEL%%"'
      The syntax of the command is incorrect.
      Build step 'Invoke Ant' marked build as failure
      Finished: FAILURE

          [JENKINS-13490] Passing multiline text parameter to ant broken (windows)

          Jem Mawson created issue -

          Can someone advice when this will be fixed

          Sarathy Gunasekaran added a comment - Can someone advice when this will be fixed

          Jem Mawson added a comment - - edited

          I'm not sure if they take this into consideration, but maybe if you vote for the bug report it will move up the queue.

          Jem Mawson added a comment - - edited I'm not sure if they take this into consideration, but maybe if you vote for the bug report it will move up the queue.

          Martin Reck added a comment -

          Can we use the Ant commandline parameter -propertyfile?

          Martin Reck added a comment - Can we use the Ant commandline parameter -propertyfile ?

          Max Schaefer added a comment -

          I observe the same problem in a "free-style software project" and using maven in the build steps. The commandline is broken as soon as multiple lines are entered in the textbox.

          Max Schaefer added a comment - I observe the same problem in a "free-style software project" and using maven in the build steps. The commandline is broken as soon as multiple lines are entered in the textbox.

          pixman20 added a comment -

          I am having the same issue. The only workaround for me is using the 'Execute Batch command' to execute Ant manually, which means I don't get the benefits of the 'Execute Ant' build step plugin.
          In my situation, I want to have a job where users can enter the ClearCase config spec they want to use for that build (with Base ClearCase plugin) and the SCM uses that parameter for the build. I had that working correctly, but unfortunately the Ant step is then pasting in the large multi-line config spec into the Ant command line.

          I do not know why parameterized builds automatically pass values through to Ant (or Maven) at all, as I would expect this to be up to the user to do -Dmy.ant.property=${MY_BUILD_PARAMETER}
          Perhaps this can be changed to use a checkbox ('Automatically populate build parameters') that defaults to true to not break backwards compatibility, but allows us to turn it off.

          pixman20 added a comment - I am having the same issue. The only workaround for me is using the 'Execute Batch command' to execute Ant manually, which means I don't get the benefits of the 'Execute Ant' build step plugin. In my situation, I want to have a job where users can enter the ClearCase config spec they want to use for that build (with Base ClearCase plugin) and the SCM uses that parameter for the build. I had that working correctly, but unfortunately the Ant step is then pasting in the large multi-line config spec into the Ant command line. I do not know why parameterized builds automatically pass values through to Ant (or Maven) at all, as I would expect this to be up to the user to do -Dmy.ant.property=${MY_BUILD_PARAMETER} Perhaps this can be changed to use a checkbox ('Automatically populate build parameters') that defaults to true to not break backwards compatibility, but allows us to turn it off.

          pixman20 added a comment -

          I found a semi-workaround for the problem. It is a semi-workaround since it only works if you don't need Ant to know about the parameter passed in (in my case I'm using it elsewhere and don't need Ant to know the value is).
          Installing the the env-inject plugin will allow you to add a build step to inject environment variables before the Ant task. In the properties section set the name of the parameter that may be multi-lined to some dummy value. This will override the existing value and then pass that through to Ant allowing it build.

          pixman20 added a comment - I found a semi-workaround for the problem. It is a semi-workaround since it only works if you don't need Ant to know about the parameter passed in (in my case I'm using it elsewhere and don't need Ant to know the value is). Installing the the env-inject plugin will allow you to add a build step to inject environment variables before the Ant task. In the properties section set the name of the parameter that may be multi-lined to some dummy value. This will override the existing value and then pass that through to Ant allowing it build.
          pixman20 made changes -
          Environment Original: Win XP, Chrome. New: Win XP, Chrome.
          Windows 7, Firefox/IE
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 143956 ] New: JNJira + In-Review [ 176042 ]

          Code changed in jenkins
          User: Stefan Wolf
          Path:
          src/test/groovy/hudson/plugins/gradle/GradlePluginIntegrationTest.groovy
          http://jenkins-ci.org/commit/gradle-plugin/0103221b20c2e35f6dfa2fb061c8c64ab52a90e2
          Log:
          Disable multiline parameter test on Windows

          Looks like JENKINS-13490 prevents this from working.

          Compare: https://github.com/jenkinsci/gradle-plugin/compare/dc52f9f2c4b7...0103221b20c2

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stefan Wolf Path: src/test/groovy/hudson/plugins/gradle/GradlePluginIntegrationTest.groovy http://jenkins-ci.org/commit/gradle-plugin/0103221b20c2e35f6dfa2fb061c8c64ab52a90e2 Log: Disable multiline parameter test on Windows Looks like JENKINS-13490 prevents this from working. Compare: https://github.com/jenkinsci/gradle-plugin/compare/dc52f9f2c4b7...0103221b20c2

            Unassigned Unassigned
            synesso Jem Mawson
            Votes:
            13 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: