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:
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.