-
-
Notifications
You must be signed in to change notification settings - Fork 636
Open
Description
👻 Brief Description
When attempting to use the jenkins_script
resource with the groovy_path
attribute set, as opposed to the command attribute set to a block of inline Groovy code, jenkins-cli returns the following error:
ERROR: This command is requesting the -remoting mode which is no longer supported. See https://www.jenkins.io/redirect/cli-command-requires-channel
I have a workaround that allows me to use a groovy file written by a template resource, which looks like this:
template ::File.join(Chef::Config[:file_cache_path], 'add_authentication.groovy') do
source 'add_authentication.groovy.erb'
mode '0644'
owner 'jenkins'
group 'jenkins'
variables(
password: 'somepassword'
)
notifies :execute, 'jenkins_script[add_authentication]', :immediately
sensitive true
end
jenkins_script 'add_authentication' do
command(lazy { ::File.open(::File.join(Chef::Config[:file_cache_path], 'add_authentication.groovy')).read })
not_if 'grep ldapserver /var/lib/jenkins/config.xml'
end
🥞 Cookbook version
9.5.0
👩🍳 Chef-Infra Version
17.8.25
🎩 Platform details
Ubuntu 20.04 LTS
Steps To Reproduce
Within some recipe, use include the following:
template ::File.join(Chef::Config[:file_cache_path], 'add_authentication.groovy') do
source 'add_authentication.groovy.erb'
mode '0644'
owner 'jenkins'
group 'jenkins'
variables(
password: 'somepassword'
)
notifies :execute, 'jenkins_script[add_authentication]', :immediately
sensitive true
end
jenkins_script 'add_authentication' do
groovy_path ::File.join(Chef::Config[:file_cache_path], 'add_authentication.groovy')
not_if 'grep ldapserver /var/lib/jenkins/config.xml'
end
You should get the error mentioned above during convergence.
🚓 Expected behavior
The executed jenkins-cli command should look something like this:
java -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://localhost:8080 -webSocket -auth @<some cli file> groovy = < /tmp/kitchen/cache/add_authentication.groovy
It currently looks something like this:
java -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://localhost:8080 -webSocket -auth @<some cli file> groovy < /tmp/kitchen/cache/add_authentication.groovy
The additional =
sign in the first example above is what seems to allow it to behave the way it should, without throwing the error about the -remoting
option no longer being supported.
Metadata
Metadata
Assignees
Labels
No labels