0

How do I use credentials-binding in a freestyle project?

Jenkins 2.86

Jenkins Job Builder 2.0.0

 

I'm able to use the credentials-binding plugin in a freestyle project, but the values are "****" for both username and password. I can't find any concrete resource on how to retrieve the actual values from the specified credentials.

The closest I've come is this post: https://support.cloudbees.com/hc/en-us/articles/203802500/comments/115000005711 which was never answered. 

Any tips are much appreciated. Thanks!

3 comments

  • 0
    Avatar
    Denys Digtiar

    Secrets by default are hidden on the UI to protect you from the accidental exposure. The environment variable to which the secrets are bound should contain actual values.

  • 0
    Avatar
    Brian Auron

    Hi Denys,

     

    So the plugin (or Jenkins itself?) looks for the value of the password and masks it in the console regardless of where that value is stored?

    For example, given the binding:

    - credentials-binding:
         - username-password-separated:
            credential-id: super-awesome-creds-id
            username: SUPERAWESOMEUSER
            password: SUPERAWESOMEPASS



    and shell build step:


    #!/usr/bin/env bash

    tempvar="${SUPERAWESOMEUSER}"
    echo "I found it: ${tempvar}"

     

    then it's expected that the echo will produce "****" (which it does)?

  • 0
    Avatar
    Denys Digtiar

    Yes, in this case, I believe it is the Credentials Binding plugin that does the Console Output filtering but it is enabled by the extension points in the Jenkins core.

Please sign in to leave a comment.