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

key=value parameter content causes build failure due to property conversion and windows bug

    Details

    • Similar Issues:

      Description

      This may overlap with other Windows parameterization bugs but I did not see it described exactly.

      Steps to reproduce:
      1. Create a build with a simple ant file to just echo "Hello World" or whatever.
      2. Add a string parameter to the job called TEST_PARAM.
      3. Build with nothing in the parameter (empty string) - build succeeds (but note that -DTEST_PARAM="" is being passed to the ant cmd
      4. Build again typing "foo" as the parameter - succeeds (but note that -DTEST_PARAM=foo is being passed to the ant cmd)
      5. (THE BUG) Build again setting "foo=bar" as the parameter value. You might want to do this, for example, to have a parameter that lets you override arbitrary ant properties. But now the build fails, because windows ant invocation can't handle -DTEST_PARAM=foo=bar - it somehow treats that 2nd '=' as a separator and then treats "bar" as a target name:

      BUILD FAILED
      Target "bar" does not exist in the project "env-test".

      Note that this all works fine on Mac OS X (and presumably Linux).

      However note also - what I think is the real bug - nowhere is a build parameter documented as being automatically injected as an ant property via -D. The parameters are supposed to become environment variables. We can turn env vars into ant targets, or properties, or whatever we want (and also keep properties we don't want out of ant that way) - why is Jenkins always trying to turn them into -D[param]=[value] ant properties?

      We encountered this because we want to have a parameterized job let us set arbitrary properties for ant invokation, e.g. a CUSTOM_PROPERTIES text param where the user can type "prop1=value", etc., and $CUSTOM_PROPERTIES is then put in the Ant task configuration's Properties area. There's no way to do this on Windows due to this bug.

      Suggested fix: stop treating every parameter as an ant property, let the user decide. Alternately: fix the Windows ant task invocation to tolerate key=value text as property values.

        Attachments

          Activity

          Hide
          olhado22 Mike Chmielewski added a comment -

          Removing parameter-separator-plugin from components, as it does not seem to be causing the problem.

          Show
          olhado22 Mike Chmielewski added a comment - Removing parameter-separator-plugin from components, as it does not seem to be causing the problem.
          Hide
          olhado Mike Chmielewski added a comment -

          Is it okay if I remove the parameter-separator-plugin from this ticket? It looks like the plugin exacerbates an issue with ant + windows, but is not a bug in the parameter separator plugin itself.

          Show
          olhado Mike Chmielewski added a comment - Is it okay if I remove the parameter-separator-plugin from this ticket? It looks like the plugin exacerbates an issue with ant + windows, but is not a bug in the parameter separator plugin itself.
          Hide
          jtufano Joe Tufano added a comment -

          We too are having this issue (Jenkins 1.588 on Windows). We prefer the option to stop treating every parameter as an Ant property. We tend to have jobs invoking Ant, Shell, among others. The parameters are divided between each. Let us decide what to use where. If a parameter is to be used as an Ant property, let us set it there. That is what the Property field is for, isn't it?

          Show
          jtufano Joe Tufano added a comment - We too are having this issue (Jenkins 1.588 on Windows). We prefer the option to stop treating every parameter as an Ant property. We tend to have jobs invoking Ant, Shell, among others. The parameters are divided between each. Let us decide what to use where. If a parameter is to be used as an Ant property, let us set it there. That is what the Property field is for, isn't it?

            People

            • Assignee:
              Unassigned
              Reporter:
              ccorbell Christopher Corbell
            • Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: