Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-61386

Declarative `credentials` step should allow override-able variable names

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • credentials-plugin
    • None

      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')
      

            Unassigned Unassigned
            jakauppila Jared Kauppila
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: