hashchen
hashchen

Reputation: 1041

How to execute groovy script on Jenkins server locally

I already have my Jenkins installed and running, I tried to run a Groovy script on my local Jenkins server itself:

java -jar jenkins-cli.jar  -s http://localhost:8080/ -auth admin:password groovy test.groovy

but I got:

ERROR: This command is requesting the -remoting mode which is no longer supported. See https://jenkins.io/redirect/cli-command-requires-channel

So if I want to execute a Groovy script on Jenkins server locally, not through the interface such as JENKINS_URL/script, what should I do?

Can anyone help me ? Thanks

Upvotes: 1

Views: 2954

Answers (1)

eremmel
eremmel

Reputation: 372

Try to use:

jar jenkins-cli.jar  -s http://localhost:8080/ -auth admin:password groovy = < test.groovy

Credits to cli ibook, see also http://localhost:8080/cli/command/groovy

Upvotes: 7

Related Questions