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

Different behavior accessing user credentials using RunAs Specific vs. Triggered User

XMLWordPrintable

      Using a trivial Pipeline project, we are seeing differing credential behavior with `Run As Specific User` vs `Run As User who Triggered Build` using User Private credentials (https://<server>/user/<user>/credentials/store/user/domain/_/).

       

      Here is the code for the Pipeline. This is configured inline in the Pipeline Job.

      // code placeholder
      node {
          withCredentials([usernameColonPassword(credentialsId: 'user-private-credential', variable: 'SOME_VALUE')]) {
              sh('echo ${SOME_VALUE} | shasum')
          }
      }
      

       

      In the Pipeline above `user-private-credential` is defined for the user executing the script.

      When the Authorization mode is set to "Run As Specific Build", the script is able to successfully retrieve the user's credentials.

       

      If the Authorization mode is set to "Run As User who Triggered Build", then the pipeline is unable to retrieve the credentials.

       

      The desired behavior is to be able to retrieve the credentials in both cases.

       

            iamahern Michael Ahern
            iamahern Michael Ahern
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: