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

credentials set via 'withCredentials' block isn't accesible from 'env'

XMLWordPrintable

      Unclear if it's in workflow or in credentials-binding plugin.

      During an engagement, I found that the following ugly but seemingly valid workflow script doesn't let me acess the value of the secret:

      def credential(name) {
        def v;
        withCredentials([[$class: 'StringBinding', credentialsId: name, variable: 'foo']]) {
            v = env.foo;
        }
        return v
      }
      
      node {
        echo credential("idOfSecretText")
      }
      

            jglick Jesse Glick
            kohsuke Kohsuke Kawaguchi
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: