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

EnvInject cannot inject variables whose contents contain a dollar sign ($)

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • envinject-plugin
    • None

      If I add an variable in the Jenkins configuration with a dollar sign in the content, then the variable is not injected. The console output says that the variable is unset because it is "unresolved":

      [EnvInject] - Executing scripts and injecting environment variables after the SCM step.
      [EnvInject] - Injecting as environment variables the properties content 
      ADMIN_PASS="pas$word"
      
      [EnvInject] - Variables injected successfully.
      [EnvInject] - Unset unresolved 'ADMIN_PASS' variable.
      

      I've tried single quotes and double quotes, escaping with \$ and with $$, and nothing works: every time, the variable is unset. Help?

          [JENKINS-13157] EnvInject cannot inject variables whose contents contain a dollar sign ($)

          David Baumgold created issue -
          David Baumgold made changes -
          Description Original: If I add an variable in the Jenkins configuration with a dollar sign in the content, then the variable is not injected. The console output says that the variable is unset because it is "unresolved":

          [EnvInject] - Executing scripts and injecting environment variables after the SCM step.
          [EnvInject] - Injecting as environment variables the properties content
          ADMIN_PASS="pas$word"

          [EnvInject] - Variables injected successfully.
          [EnvInject] - Unset unresolved 'ADMIN_PASS' variable.

          I've tried single quotes and double quotes, escaping with \$ and with $$, and nothing works: every time, the variable is unset. Help?
          New: If I add an variable in the Jenkins configuration with a dollar sign in the content, then the variable is not injected. The console output says that the variable is unset because it is "unresolved":

          {code}
          [EnvInject] - Executing scripts and injecting environment variables after the SCM step.
          [EnvInject] - Injecting as environment variables the properties content
          ADMIN_PASS="pas$word"

          [EnvInject] - Variables injected successfully.
          [EnvInject] - Unset unresolved 'ADMIN_PASS' variable.
          {code}

          I've tried single quotes and double quotes, escaping with \$ and with $$, and nothing works: every time, the variable is unset. Help?
          Gregory Boissinot made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Gregory Boissinot made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]
          Nick Grealy made changes -
          Link New: This issue duplicates JENKINS-15751 [ JENKINS-15751 ]
          Alexandre Zia made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Nick Grealy made changes -
          Link New: This issue duplicates JENKINS-13566 [ JENKINS-13566 ]
          Nick Grealy made changes -
          Assignee Original: Gregory Boissinot [ gbois ] New: David Baumgold [ singingwolfboy ]
          Andrew Gray made changes -
          Comment [
          I tried the following evaluated groovy script with v1.92.1 of the plugin:

          {code:java}
          switch (ENV) {
                  case 'DEV':
          def map = [WEB_SERVER: '<machine name>.', DB_SERVER: '<machine name>', DRIVE_LETTER: 'D$$']
          return map
          break
          case 'TEST':
          def map = [WEB_SERVER: '<machine name>', DB_SERVER: '<machine name>', DRIVE_LETTER: 'D$$']
          return map
          break
          default:
          def map = [WEB_SERVER: '', DB_SERVER: '', DRIVE_LETTER: '']
          return map
          break
          }
          {code}

          which still didn't work.

          [EnvInject] - Injecting contributions.
          Building in workspace ...
          [EnvInject] - Unset unresolved 'DRIVE_LETTER' variable.
          ]
          Andrew Gray made changes -
          Comment [ I tried the following evaluated groovy script with v1.92.1 of the plugin:

          {code:java}
          switch (ENV) {
                  case 'DEV':
          def map = [WEB_SERVER: '<machine name>.', DB_SERVER: '<machine name>', DRIVE_LETTER: 'D$$']
          return map
          break
          case 'TEST':
          def map = [WEB_SERVER: '<machine name>', DB_SERVER: '<machine name>', DRIVE_LETTER: 'D$$']
          return map
          break
          default:
          def map = [WEB_SERVER: '', DB_SERVER: '', DRIVE_LETTER: '']
          return map
          break
          }
          {code}

          which still didn't work.

          [EnvInject] - Injecting contributions.
          Building in workspace ...
          [EnvInject] - Unset unresolved 'DRIVE_LETTER' variable.
          ]
          Andrew Gray made changes -
          Comment [ I tried the following evaluated groovy script with v1.92.1 of the plugin:

          {code:java}
          switch (ENV) {
                  case 'DEV':
          def map = [WEB_SERVER: '<machine name>.', DB_SERVER: '<machine name>', DRIVE_LETTER: 'D$$']
          return map
          break
          case 'TEST':
          def map = [WEB_SERVER: '<machine name>', DB_SERVER: '<machine name>', DRIVE_LETTER: 'D$$']
          return map
          break
          default:
          def map = [WEB_SERVER: '', DB_SERVER: '', DRIVE_LETTER: '']
          return map
          break
          }
          {code}

          which still didn't work when ENV = 'DEV' or 'TEST'.


          {code:java}
          [EnvInject] - Injecting contributions.
          Building in workspace ...
          [EnvInject] - Unset unresolved 'DRIVE_LETTER' variable.

          {code}
          ]

            Unassigned Unassigned
            singingwolfboy David Baumgold
            Votes:
            4 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: