-
Bug
-
Resolution: Unresolved
-
Blocker
-
Kubernetes
I have the following secret in Kubernetes cluster:
```
apiVersion: v1
kind: Secret
metadata:
name: mysecret
namespace: <namespace>
labels:
credential.sync.jenkins.openshift.io: 'true'
type: Opaque
data:
username: <username>
password: <password>
```
I have tried to restart the jenkins pod in my k8s cluster. However, the secret does not show up in the jenkins /credentials/ page.
According to https://jenkinsci.github.io/kubernetes-credentials-provider-plugin/ I have also tried the following secret label:
```
apiVersion: v1
kind: Secret
metadata:
name: mysecret
namespace: <namespace>
labels:
"jenkins.io/credentials-type": "usernamePassword"
type: Opaque
data:
username: <username>
password: <password>
```
And accessing it in my jenkins pipeline Jenkinsfile using the following snippet:
```
withCredentials([usernamePassword(credentialsId: 'nexus', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { withCredentials([usernamePassword(credentialsId: 'mysecret', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')])
{ echo PASSWORD echo USERNAME }```
result in the following error:
`ERROR: Could not find credentials entry with ID 'mysecret'`
[JENKINS-62737] Kubernetes secret doesn't show up in Jenkins /credentials/ page
Description |
Original:
I have the following secret in Kubernetes cluster: ``` apiVersion: v1 kind: Secret metadata: name: mysecret namespace: <namespace> labels: credential.sync.jenkins.openshift.io: 'true' type: Opaque data: username: <username> password: <password> ``` I have tried to restart the jenkins pod in my k8s cluster. However, the secret does not show up in the jenkins /credentials/ page. What do I miss? |
New:
I have the following secret in Kubernetes cluster: ``` apiVersion: v1 kind: Secret metadata: name: mysecret namespace: <namespace> labels: credential.sync.jenkins.openshift.io: 'true' type: Opaque data: username: <username> password: <password> ``` I have tried to restart the jenkins pod in my k8s cluster. However, the secret does not show up in the jenkins /credentials/ page. According to [https://jenkinsci.github.io/kubernetes-credentials-provider-plugin/] I have also tried the following secret label: ``` apiVersion: v1 kind: Secret metadata: name: mysecret namespace: <namespace> labels: "jenkins.io/credentials-type": "usernamePassword" type: Opaque data: username: <username> password: <password> ``` And accessing it in my jenkins pipeline Jenkinsfile using the following snippet: ``` withCredentials([usernamePassword(credentialsId: 'nexus', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { withCredentials([usernamePassword(credentialsId: 'mysecret', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { sh 'echo $PASSWORD' sh 'echo USERNAME' } ``` result in the following error: `ERROR: Could not find credentials entry with ID 'mysecret'` |
Description |
Original:
I have the following secret in Kubernetes cluster: ``` apiVersion: v1 kind: Secret metadata: name: mysecret namespace: <namespace> labels: credential.sync.jenkins.openshift.io: 'true' type: Opaque data: username: <username> password: <password> ``` I have tried to restart the jenkins pod in my k8s cluster. However, the secret does not show up in the jenkins /credentials/ page. According to [https://jenkinsci.github.io/kubernetes-credentials-provider-plugin/] I have also tried the following secret label: ``` apiVersion: v1 kind: Secret metadata: name: mysecret namespace: <namespace> labels: "jenkins.io/credentials-type": "usernamePassword" type: Opaque data: username: <username> password: <password> ``` And accessing it in my jenkins pipeline Jenkinsfile using the following snippet: ``` withCredentials([usernamePassword(credentialsId: 'nexus', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { withCredentials([usernamePassword(credentialsId: 'mysecret', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { sh 'echo $PASSWORD' sh 'echo USERNAME' } ``` result in the following error: `ERROR: Could not find credentials entry with ID 'mysecret'` |
New:
I have the following secret in Kubernetes cluster: ``` apiVersion: v1 kind: Secret metadata: name: mysecret namespace: <namespace> labels: credential.sync.jenkins.openshift.io: 'true' type: Opaque data: username: <username> password: <password> ``` I have tried to restart the jenkins pod in my k8s cluster. However, the secret does not show up in the jenkins /credentials/ page. According to [https://jenkinsci.github.io/kubernetes-credentials-provider-plugin/] I have also tried the following secret label: ``` apiVersion: v1 kind: Secret metadata: name: mysecret namespace: <namespace> labels: "jenkins.io/credentials-type": "usernamePassword" type: Opaque data: username: <username> password: <password> ``` And accessing it in my jenkins pipeline Jenkinsfile using the following snippet: ``` withCredentials([usernamePassword(credentialsId: 'nexus', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { withCredentials([usernamePassword(credentialsId: 'mysecret', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { echo PASSWORD echo USERNAME } ``` result in the following error: `ERROR: Could not find credentials entry with ID 'mysecret'` |