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

USER variable is converted to user when using UsernamePasswordCredential

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • None
    • Jenkins 2.452.3
      Credentials Binding 681.vf91669a_32e45

      When using the withCredentials block and setting the usernameVariable field to USER, the exposed environment variable is converted to user instead of USER. This only seems to occur when setting the environment variable key to USER, using fields such as USERNAME don't suffer from this problem. This behavior has changed when we upgraded the plugin from 642.v737c34dea_6c2. Note this is only affecting Linux Kubernetes containers a windows agent and Linux agent did not have this issue.

      Example pipeline

       

      withCredentials([usernamePassword(credentialsId:"my-username-password", usernameVariable:"USER", passwordVariable:"PASSWORD")]) {
          sh "echo \$USER:\$PASSWORD"
      } 

      on 681.vf91669a_32e45 it prints the following indicating the value is unset.

       

      :*********** 

      on 642.v737c34dea_6c2 

      it prints

      secret-username:*************

      printing out the environment shows the variable is set but the USER variable is set to user instead of USER as specified in the usernameVariable field 

      user=bld_ffdo

            Unassigned Unassigned
            aidaleuc Aidan
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: