9

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

Shaun
  • 475
  • 1
  • 5
  • 16
  • 2
    https://support.cloudbees.com/hc/en-us/articles/234709648-Disable-Jenkins-CLI – Rik Jun 13 '17 at 13:55

2 Answers2

15

you can do it like this (jenkins2.60.2)

import jenkins.model.Jenkins

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

Regards

juhnz
  • 304
  • 3
  • 11
8

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.

Mischa Taylor
  • 232
  • 1
  • 3