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

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

    Details

    • Similar Issues:

      Description

      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?

        Attachments

          Issue Links

            Activity

            singingwolfboy David Baumgold created issue -
            singingwolfboy David Baumgold made changes -
            Field Original Value New Value
            Description 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?
            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?
            gbois Gregory Boissinot made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            gbois Gregory Boissinot made changes -
            Status In Progress [ 3 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            nickg Nick Grealy made changes -
            Link This issue duplicates JENKINS-15751 [ JENKINS-15751 ]
            alexandrezia Alexandre Zia made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            nickg Nick Grealy made changes -
            Link This issue duplicates JENKINS-13566 [ JENKINS-13566 ]
            nickg Nick Grealy made changes -
            Assignee Gregory Boissinot [ gbois ] David Baumgold [ singingwolfboy ]
            apgray 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.
            ]
            apgray 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.
            ]
            apgray 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}
            ]
            singingwolfboy David Baumgold made changes -
            Assignee David Baumgold [ singingwolfboy ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 143621 ] JNJira + In-Review [ 186050 ]

              People

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

                Dates

                • Created:
                  Updated: