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

shell expansion not performed for Gradle switches

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • gradle-plugin
    • None
    • Hudson 1.338, Linux

      The Ant plugin passes properties specified in a build step through shell expansion, allowing me to specify something like

      -Dapp.version=${RELEASE_VERSION:-4.1dev.r${SVN_REVISION}.${BUILD_NUMBER}}
      

      This works on a Linux system with Bash. It results in app.version being set to the value of the RELEASE_VERSION variable, if it is set, or something based on SVN_REVISION otherwise.

      Unfortunately the Gradle plugin does not support this. If I put

      -Pversion=${RELEASE_VERSION:-4.1dev.r${SVN_REVISION}.${BUILD_NUMBER}}
      

      in the Switches field of the build step, what gets passed to Gradle is the verbatim string
      ${RELEASE_VERSION:-4.1dev.r1234.56}. So the built-in environment variables have been expanded but there is no shell expansion.

      It would be preferable if the two plugins had uniform behaviour so that it would be easier to migrate between the build tools.

          [JENKINS-5165] shell expansion not performed for Gradle switches

          This issue is fixed in trunk.
          Have you got the possibility to test it?

          Gregory Boissinot added a comment - This issue is fixed in trunk. Have you got the possibility to test it?

          Marcus Better added a comment -

          Still broken in 1.3.

          Marcus Better added a comment - Still broken in 1.3.

          The plugin doesn't accept -Dapp.version=${VAR:....}

          Please use -Dapp.version=${RELEASE_VERSION}:-4.1dev.r${SVN_REVISION}.${BUILD_NUMBER}

          Gregory Boissinot added a comment - The plugin doesn't accept -Dapp.version=${VAR:....} Please use -Dapp.version=${RELEASE_VERSION}:-4.1dev.r${SVN_REVISION}.${BUILD_NUMBER}

          Marcus Better added a comment -

          That is not a solution to what I'm trying to do. It would give totally different results.

          Marcus Better added a comment - That is not a solution to what I'm trying to do. It would give totally different results.

            gbois Gregory Boissinot
            mbetter Marcus Better
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: