Publish over SSH doubles `$` inside expanded environment variables from the Credentials Binding plugin

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      When I'm using global credentials from the Credentials Binding Plugin with embedded '$', they work fine in Execute shell build steps, but get doubled to '$$' when expanded (tokenized) by Publish Over SSH in Exec Command. This doesn't seem to affect regular variables, e.g. build parameters in parameterized projects.

      Steps to reproduce:

      1. Create credentials in Manage System > Manage Credentials as Username with password, e.g., SPRING_DATASOURCE_USERNAME and SPRING_DATASOURCE_PASSWORD. Use foo$bar as the password value.
      2. Create a job
      3. Build Environment > Use secret text(s) or file(s) = on. Add Username and password (separated) > SPRING_DATASOURCE_USERNAME and SPRING_DATASOURCE_PASSWORD.
      4. Add build step > Send files or execute commands over SSH. Add Transfer Set > Exec Command = echo 'SPRING_DATASOURCE_PASSWORD=${SPRING_DATASOURCE_PASSWORD}' >SPRING_DATASOURCE_PASSWORD.txt

      Expected: foo$bar in SPRING_DATASOURCE_PASSWORD.txt on a remote server
      Actual: foo$$bar in SPRING_DATASOURCE_PASSWORD.txt on a remote server

      Note:
      If I use the similar command in Execute shell : echo "SPRING_DATASOURCE_PASSWORD=${SPRING_DATASOURCE_PASSWORD}" >SPRING_DATASOURCE_PASSWORD.txt, the expected value is stored correctly. This flavor has to use double quotes to allow shell expansion to happen.

            Assignee:
            Unassigned
            Reporter:
            Dmytro Korobskiy
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: