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

Ant plugin does not correctly resolve and property resolving empty build parameter

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: ant-plugin
    • Labels:
      None
    • Environment:
      Jenkins: 2.43
      Ant Plugin: 1.4

      OS: Mac/Linux/Windows - though problems most pronounced on windows
    • Similar Issues:

      Description

      If an ant build passes through a parameter referencing a "build parameter", the replacement will not occur if the build parameter is an empty string.

      e.g. if properties on Ant build step are:

      myprop=$buildVariable

      The resulting ant command line will look like:

      ant -Dmyprop=$buildVariable

      instead of

      ant -Dmyprop=

      The reason is that the EnvVars jenkins class, will remove properties when they are empty. This odd behaviour is also discussed in JENKINS-15146 ... it would seem that empty string is valid and only null should be removed.

      This issue is particularly tricky as things will mostly work as expected on Unix operating systems because the $buildVariable will be replaced by the shell with the build variable in the environment. If fails completely on Windows because no variable expansion occurs.

      Also note that the same behaviour is not seen by the gradle plugin, as does these replacements slightly differently (replacing build parameters without putting them into EnvVars).

      I'm preparing a pull request to resolve this.

        Attachments

          Activity

          mattdoran Matt Doran created issue -
          armfergom Armando Fernandez made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              armfergom Armando Fernandez
              Reporter:
              mattdoran Matt Doran
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: