• Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • job-dsl-plugin
    • None
    • jobdsl 1.67

      We'd like to make use of credentials stored in Jenkins from a groovy class that's part of our job DSL scripts. Unfortunately this seems to be impossible since 1.43 (couldn't actually find a reference to this in the code/changelog, but did find this SO answer https://stackoverflow.com/a/40474755 ) because it's impossible to import the necessary classes.

      This simple example:

      def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(    com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class,    Jenkins.instance,    null,    null);for (c in creds) {     println(c.id + ": " + c.description)}

      from https://wiki.jenkins.io/display/JENKINS/Printing+a+list+of+credentials+and+their+IDs

      works fine in the script console but fails when putting it in a job DSL script.

      This means the only way for us to provide these credentials is as hardcoded strings in our job DSL scripts, which is of course not acceptable.

          [JENKINS-52266] Unable to use credentials in groovy class

          Simon van der Veldt created issue -
          Daniel Spilker made changes -
          Link New: This issue duplicates JENKINS-27517 [ JENKINS-27517 ]
          Daniel Spilker made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Daniel Spilker made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

            daspilker Daniel Spilker
            simonvanderveldt Simon van der Veldt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: