How to use credentials in User scope stored on Jenkins of OpenShift?
Issue
-
In a jenkins pipeline, credentials in User scope stored on Jenkins cannot be used directly like this:
pipeline{ agent{label 'maven'} stages{ stage('Credential'){ steps{ script{ openshift.withCluster(){ openshift.withProject(){ openshift.withCredentials('user-1-credential'){ echo "${openshift.raw("whoami")}" // result: err=error: You must be logged in to the server (Unauthorized)
Environment
- Red Hat OpenShift Container Platform
- Jenkins
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.