sous-chefs / jenkins

Development repository for the jenkins cookbook
https://supermarket.chef.io/cookbooks/jenkins
Apache License 2.0
424 stars 636 forks source link

jenkins_plugin resource does not respect :cli_credential_file #778

Open mromero-convoso opened 2 years ago

mromero-convoso commented 2 years ago

:ghost: Brief Description

If a Chef recipe is configured with the ":cli_credential_file" setting set in its run state, the "jenkins_plugin" resource will still attempt to invoke jenkins-cli without the appropriate auth file.

:pancakes: Cookbook version

9.5.0

:woman_cook: Chef-Infra Version

17.8.25

:tophat: Platform details

Ubuntu 20.04 LTS

Steps To Reproduce

Steps to reproduce the behavior:

  1. With authentication configured in some manner beyond the default, place the following snippet within a recipe.
    
    file ::File.join(Chef::Config[:file_cache_path], 'creds') do
    content "jenkinsmgr:somepassword"
    mode '0644'
    owner 'jenkins'
    group 'jenkins'
    sensitive true
    end

node.run_state[:cli_credential_file] = ::File.join(Chef::Config[:file_cache_path], 'creds')

jenkins_plugin do action :install version install_deps false end



The install will attempt to install the plugin without specifying `-auth @<creds file>`  in the args to jenkins-cli

## :police_car: Expected behavior

Expect that jenkins_plugin respects the `:cli_credential_file` variable, when set, similar to how the jenkins_script resource does. There are perhaps other resources that will need to be examined for support for `:cli_credential_file` as well.