Jenkins Disable CLI via Remoting through Groovy Script

Is it possible to disable Jenkins CLI through the Remoting option via Groovy script? I want to put the script in init.groovy.d so that the option is disabled at startup, so I am not prompted to disable it.

thanks

+8
jenkins groovy jenkins-cli
source share
2 answers

you can do it like this (jenkins2.60.2)

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

Yours faithfully

+8
source share

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

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

It will behave as if you clicked the "Disable JIINLIN CLI over Remoting" button in the Jenkins GUI after the server restarts.

Yuhnz's answers completely disable the CLI. However, I believe that the purpose of the question was to simply disable the Jenkins CLI only when uninstalling, but otherwise enable the CLI.

+4
source share

All Articles