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

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

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")
      }
      

            Assignee:
            Jesse Glick
            Reporter:
            Kohsuke Kawaguchi
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: