-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major
-
Component/s: bitbucket-branch-source-plugin
-
None
-
Environment:Helm Chart Version/App Version:
chaos-mesh-2.8.1/2.8.1
jenkins-5.9.9/2.541.3
vault-0.32.0/1.21.2
Jenkins Plugins:
cloudbees-bitbucket-branch-source:937.2.5
hashicorp-vault-plugin:379.v080d932e61e4
Multiple plugins extend Credentials with providers that allow storing credentials in external credential stores, e.g., Hashicorp Vault, AWS Secrets Manager, Kubernetes Secrets, etc. The list of the open-source ones is at https://www.jenkins.io/doc/developer/extensions/credentials/#credentialsprovider
These would generally require network requests to get the actual secrets. Given the default timeout for adding credential types to the deny list is 250 ms starting from https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/1157 . Any network latency that is over 250ms might result in a valid credentials being removed from the dropdown until the restart of the controller.Â
Â
Rough steps I used to reproduce the issue in the test environment:
- Create a Kind cluster https://kind.sigs.k8s.io/docs/user/quick-start/
- Launch `cloud-provider-kind` to get Ingress and Gateway APIs https://kind.sigs.k8s.io/docs/user/ingress/
- Create namespaces: `jenkins`, `vault`, `chaos-mesh`
- Create a Gateway in the `jenkins` namespace using the attached `gateway.yaml`
- Install the `jenkins` Helm chart using the attached `jenkins-values.yaml` into the `jenkins` namespace
- Ensure Bitbucket Branch Source and HashiCorp Vault plugins are installed
- Create a handful of Credentials in the built-in store at the root and Folder level to have some local test credentials.
- Install the `vault` chart into the `vault` namespace using attached `vault-values.yaml`
- Ensure kv v2 secrets engine is enabled
- Add `jenkins/bitbucket` secret with a valid email and API token.
- Ensure the `approle` authentication method is enabled
- Add `jenkins` policy granting access to the secrets under the `jenkins/` prefix (see below)
- Use CLI/API to create a Jenkins role with the `jenkins` policy, https://developer.hashicorp.com/vault/docs/auth/approle
- Back on Jenkins
- Add "Vault App Role Credential" to the system credentials store using the Role ID and Secret ID from step 6.5
- In "Manage > System" configure "Vault URL" (e.g. `http://vault.vault.svc.cluster.local:8200`) and "Vault Credential" (credential from 7.1)
- Back in System Credential Store add "Vault Username-Password Credential". "Path" is `secret/jenkins/bitbucket`. The username and password keys are whatever was used in step 6.2
- Create an Organization Folder or Multibranch Pipeline using the credential from 7.3. Ensure that the scan and branch pipeline builds are successful.
- Install the `chaos-mesh` chart into the `chaos-mesh` namespace using the attached `chaos-mech-values.yaml`, https://chaos-mesh.org/docs/production-installation-using-helm/
- `kubectl apply` the attached `chaos-experiment-network-delay.yaml`. It should add the 300ms latency between Jenkins and Vault for 5 minutes
- Back on Jenkins, open the configuration of Organization Folder or Multibranch Pipeline
- Try creating a new Multibranch Pipeline or Organization Folder
Expected: The HashiCorp Vault Bitbucket credential is shown in the existing item and available for the creation of a new item
Actual: In the existing item, the "Credentials" field shows `- none -` and when the dropdown is opened, there are no Vault credentials. The scan and builds still work since `config.xml` retains the credential id until overwritten. In the new Organization Folder/Multibranch Pipeline configuration page the Vault credentials are not shown.
Â
Vault Policy example:
// allow jenkins to read secrets path "secret/data/jenkins/*" { capabilities = [ "read", "list" ] }
Â
The default timeout can be configured using an undocumented system property: `
bitbucket.credentials.resolutionTimeout`.Â
Â
- is caused by
-
JENKINS-76330 Issue with bitbucket source and AWS credential plugin configuring Multibranch Pipeline
-
- Resolved
-
-
JENKINS-64183 fillCredentialsIdItems fails when Amazon ECR plugin is installed
-
- Closed
-
-
JENKINS-75184 CredentialsMatcher fail with ECR Security Token
-
- Closed
-