CloudBees CI Managed Controller 2.361.1.2-rolling running on OpenShift.
There is a k8s secret in the agents namespace:
I need to access this in my Jenkins pipeline e.g.
script.withCredentials([script.string( credentialsId: "${credentialsEnvironment}", variable: 'usernamePassword') ]) {
String auth = "${script.usernamePassword}".bytes.encodeBase64().toString()
Map params = defaultArgs + httpParams
def response = []
try {
response = script.httpRequest(
params +
[
url: "${apiEndpoint}/${url}",
customHeaders: [[name: 'Authorization', value: "Basic ${auth}"]]
]
)
} The pipeline fails because it cannot find the credentialId:
09:14:12 credentialsEnvironment: grafana-admin-user
09:14:12 [Pipeline] withCredentials
09:14:12 [Pipeline] // withCredentials
09:14:12 [Pipeline] echo
09:14:12 org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: Could not find credentials entry with ID 'grafana-admin-user'
There is a suggestion to use the Kubernetes Credentials Provider plugin but we wish to do it in a Jenkins-native way than to add one more plug-in.