Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Disable CLI over Remoting via a Groovy Script

Is is possible to disable Jenkins CLI over Remoting option via Groovy script? I want to put the script into init.groovy.d so that is option is disabled upon start up so I am not prompted to disable it

Thanks

like image 209
Shaun Avatar asked Jun 12 '17 14:06

Shaun


Video Answer


2 Answers

Create the file $JENKINS_HOME/jenkins.CLI.xml with the following content:

<?xml version='1.0' encoding='UTF-8'?>
<jenkins.CLI>
  <enabled>false</enabled>
</jenkins.CLI>

It will behave as if you pressed the "Disable Jenkins CLI over Remoting" button in the Jenkins GUI once the server restarts.

juhnz's answer covers disabling the CLI completely. However, I believe the intent of the question was just disable the Jenkins CLI over remoting, only, but otherwise enable the CLI.

like image 109
Mischa Taylor Avatar answered Oct 19 '22 01:10

Mischa Taylor


you can do it like this (jenkins2.60.2)

import jenkins.model.Jenkins

jenkins.model.Jenkins.instance.getDescriptor("jenkins.CLI").get().setEnabled(false)

Regards

like image 15
juhnz Avatar answered Oct 18 '22 23:10

juhnz