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

Allow custom file to use Credentials

    Details

    • Similar Issues:

      Description

      Similar to the Maven Settings configuration it would be nice to be able to select Credentials from the Credentials plugin for custom configuration files. Perhaps allow us to enter a keyword in the custom configuration file eg {APP_PASSWORD} and then we can select a Credential and match it to a parameter so that it gets automatically replaced when the CFP plugin pushes the configuration to the builder.

        Attachments

          Activity

          Hide
          imod Dominik Bartholdi added a comment -

          as a workaround, you could use the "Credentials Binding Plugin" [1] and reference the credentials as env variables in your file. In the configuration of your job, just check the box "Replace Tokens" for the respective configuration file and the env variables will be replaced within the file at runtime.

           

          [1]https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Binding+Plugin

          Show
          imod Dominik Bartholdi added a comment - as a workaround, you could use the "Credentials Binding Plugin" [1] and reference the credentials as env variables in your file. In the configuration of your job, just check the box "Replace Tokens" for the respective configuration file and the env variables will be replaced within the file at runtime.   [1] https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Binding+Plugin
          Hide
          tykeal Andrew Grimberg added a comment -

          I would like to vote this up and give some reasoning as to why using the replace tokens doesn't work in all cases.

          We use Jenkins-Job-Builder to generate our jobs using job templates, and while you can use the replace tokens option, along with injecting the credentials into the environment with the Credentials Binding plugin, the biggest issue is that the Credentials Binding Plugin is a job wrapper and you therefore can't define what credential you need at the time of the job definition itself (that is just before being used). This makes writing recomposable macros impossible to use without having to do a lot of heavy work in the job definitions themselves.

          Additionally, with the advent of Jenkins Configuration as Code, making it possible to define all the tokenization and bound credentials at time of file definition becomes much more important for running community managed systems where the community can define the managed files and utilize already configured credentials, but they don't have access to the credential definitions themselves.

          Show
          tykeal Andrew Grimberg added a comment - I would like to vote this up and give some reasoning as to why using the replace tokens doesn't work in all cases. We use Jenkins-Job-Builder to generate our jobs using job templates, and while you can use the replace tokens option, along with injecting the credentials into the environment with the Credentials Binding plugin, the biggest issue is that the Credentials Binding Plugin is a job wrapper and you therefore can't define what credential you need at the time of the job definition itself (that is just before being used). This makes writing recomposable macros impossible to use without having to do a lot of heavy work in the job definitions themselves. Additionally, with the advent of Jenkins Configuration as Code, making it possible to define all the tokenization and bound credentials at time of file definition becomes much more important for running community managed systems where the community can define the managed files and utilize already configured credentials, but they don't have access to the credential definitions themselves.

            People

            • Assignee:
              domi Dominik Bartholdi
              Reporter:
              zxiiro Thanh Ha
            • Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: