withCredentials in the "options { }" section of declarative pipeline

10 views
Skip to first unread message

Kamil Dzierzanowski

unread,
Sep 25, 2020, 9:28:33 AM9/25/20
to Jenkins Users
Hi!

Recently while reading an error raised when incorrectly specifying an option in the options section of the declarative pipeline, I noticed several options which supposedly are accepted, though not documented in the snippet generator nor in the online documentation. One of these options is the withCredentials() wrapper - I tested it like this and it worked:

pipeline {
   options {
      withCredentials(...)
   }
   steps {
      ...
   }
}

The credentials were visible in all steps within the pipeline further down. Now, this is an awesome feature and I find many use cases for this, but am afraid this might be a deprecated feature soon to be removed. Or, perhaps this is an intended behavior, given the wrapper is implemented properly. Is there anyone who can confirm the status of this feature?

Best regards,
Kamil
Reply all
Reply to author
Forward
0 new messages