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 pem certificates #232

Closed timja closed 10 months ago

timja commented 10 months ago

Azure Key Vault supports two formats for certificates, PEM and PFX (aka PKCS#12).

This adds support for PEM

Fixes https://github.com/jenkinsci/azure-keyvault-plugin/issues/231

Testing done

Created a certificate in key vault with PEM content type Loaded it in a pipeline with:

node {
     theSecrets = [

                [ secretType: 'Secret', name: 'aaaa', envVariable: 'slackToken'],
                [envVariable: 'CODESIGNCERT', name: 'my-cert', secretType: 'Certificate'],
                [envVariable: 'CODESIGNCERT2', name: 'pem-cert', secretType: 'Certificate']
            ]
           // node {
            azureKeyVault(theSecrets) {
                echo env.slackToken
                echo env.CODESIGNCERT.substring(0, env.CODESIGNCERT.size() - 1)

                //sh "cat $CODESIGNCERT2"

                echo env.CODESIGNCERT2.substring(0, env.CODESIGNCERT2.size() - 1)
            } 
}
### Submitter checklist
- [ ] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch!
- [ ] Ensure that the pull request title represents the desired changelog entry
- [ ] 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