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

Injecting from file removes backslashes on ${WORKSPACE}

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: envinject-plugin
    • Labels:
      None
    • Environment:
      Windows Server 2003
    • Similar Issues:

      Description

      When using a configuration file, $

      {WORKSPACE} cannot be used if it contains backslashes.
      Obviously this causes a critical issue on Windows.
      When using the content section it works fine.

      Output shown in the "Injected Environment Variables" Page:
      AAACONTENTVAR D:\jenkins\jobs\TEST_FAIL\workspace
      AAAFILEVAR D:jenkinsjobsTEST_FAILworkspace

      This behavior can be reproduced by doing the following:
      1) Add build step "Execute batch script" and add the following content:
      echo AAAFILEVAR=${WORKSPACE}

      > temp.config
      2) Add build step "Inject environment variables" and add to properties file path:
      temp.config
      3) Add build step "Inject environment variables" and add to properties content:
      AAACONTENTVAR=$

      {WORKSPACE}
      4) Add build step "Execute batch script" and add the following content:
      @ECHO OFF
      echo AAAFILEVAR = %AAAFILEVAR%
      echo AAACONTENTVAR = %AAACONTENTVAR%

      Console output:
      ------------------------------------------------------------------
      Building on master in workspace D:\jenkins\jobs\TEST_FAIL\workspace
      [workspace] $ cmd /c call C:\WINDOWS\TEMP\hudson6646008055064848449.bat

      D:\jenkins\jobs\TEST_FAIL\workspace>echo AAAFILEVAR=${WORKSPACE}

      1>temp.config

      D:\jenkins\jobs\TEST_FAIL\workspace>exit 0
      [EnvInject] - Injecting environment variables from a build step.
      [EnvInject] - Injecting as environment variables the properties file path 'temp.config'
      [EnvInject] - Variables injected successfully.
      [EnvInject] - Injecting environment variables from a build step.
      [EnvInject] - Injecting as environment variables the properties content
      AAACONTENTVAR=$

      {WORKSPACE}

      [EnvInject] - Variables injected successfully.
      [workspace] $ cmd /c call C:\WINDOWS\TEMP\hudson7725197076031217954.bat
      AAAFILEVAR = D:jenkinsjobsTEST_FAILworkspace
      AAACONTENTVAR = D:\jenkins\jobs\TEST_FAIL\workspace
      Finished: SUCCESS
      ------------------------------------------------------------------

        Attachments

          Activity

            People

            • Assignee:
              gbois Gregory Boissinot
              Reporter:
              pixman20 pixman20
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: