jenkinsci / azure-keyvault-plugin

Jenkins plugin for Azure Keyvault
https://plugins.jenkins.io/azure-keyvault/
MIT License
14 stars 21 forks source link

Add support for credentials of type certificate #247

Closed ysmaoui closed 6 months ago

ysmaoui commented 6 months ago

Adding support to credentials of type certificate

withCredentials([
        certificate(
            credentialsId: certificateCredentialsId,
            keystoreVariable: 'PATH_TO_KEYSTORE',
            passwordVariable: 'PASSWORD'
        )
    ]) {
      sh(
        script: """
            curl -X POST \
                --cert-type P12 \
                --cert "\$PATH_TO_KEYSTORE":\$PASSWORD \
                ${url}
        """
      )
    }

Testing done locally with a certificate stored base64-encoded in an azure vault

image

image

### Submitter checklist
- [x] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch!
- [x] Ensure that the pull request title represents the desired changelog entry
- [x] Please describe what you did
- [ ] Link to relevant issues in GitHub or Jira
- [ ] Link to relevant pull requests, esp. upstream and downstream changes
- [ ] Ensure you have provided tests - that demonstrates feature works or fixes the issue