jenkinsci / jenkinsci/credentials-plugin

[JENKINS-61386] Declarative `credentials` step should allow override-able variable names

Open
#856 0 comments 0 reactions 0 assignees View on GitHub
component:credentials-plugin imported-jira-issue priority:minor resolution:unresolved
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


  • status: Open
  • priority: Minor
  • component(s): credentials-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-08

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.