jenkinsci / jenkinsci/credentials-plugin
[JENKINS-61386] Declarative `credentials` step should allow override-able variable names
- Dominant language
- Java
- Stars
- 134
- Forks
- 258
- Avg merge
- 48m
- Merged PRs (30d)
- 1
Description
Within a declarative pipeline, I want to be able to override the automatic variables of `credentials()` as the tooling I'm using requires the environment variables to be of a particular name.
Currently, I must do the following:
BIGIP_CREDENTIALS = credentials('BIGIP_CREDENTIALS_ID')
BIGIP_USER= "${env.BIGIP_CREDENTIALS_USR}"
BIGIP_PASSWORD = "${env.BIGIP_CREDENTIALS_PSW}"
To avoid those additional steps (and security risk, as Jenkins will not strip the values of BIGIP_USER and BIGIP_PASSWORD from the output) I would rather do one of the following:
// Allow the user to override the automatic username/password variable names
BIGIP_CREDENTIALS = credentials('BIGIP_CREDENTIALS_ID','BIGIP_USER','BIGIP_PASSWORD')
// Allow the use to only pull out the username or password
BIGIP_USER = credentials('BIGIP_CREDENTIALS_ID', 'USER')
BIGIP_PASSWORD = credentials('BIGIP_CREDENTIALS_ID', 'PASSWORD')
---
Originally reported by
jakauppila, imported from: Declarative `credentials` step should allow override-able variable names
Raw content of original issue
Within a declarative pipeline, I want to be able to override the automatic variables of `credentials()` as the tooling I'm using requires the environment variables to be of a particular name.
Currently, I must do the following:
BIGIP_CREDENTIALS = credentials('BIGIP_CREDENTIALS_ID')
BIGIP_USER = "${env.BIGIP_CREDENTIALS_USR}"
BIGIP_PASSWORD = "${env.BIGIP_CREDENTIALS_PSW}"To avoid those additional steps (and security risk, as Jenkins will not strip the values of BIGIP_USER and BIGIP_PASSWORD from the output) I would rather do one of the following:
// Allow the user to override the automatic username/password variable names
BIGIP_CREDENTIALS = credentials('BIGIP_CREDENTIALS_ID','BIGIP_USER','BIGIP_PASSWORD')// Allow the use to only pull out the username or password
BIGIP_USER = credentials('BIGIP_CREDENTIALS_ID', 'USER')
BIGIP_PASSWORD = credentials('BIGIP_CREDENTIALS_ID', 'PASSWORD')
Contributor guide
Assessment
This issue has not been assessed yet.