简体   繁体   中英

How to execute scriptler script in jenkins remotely / via REST API?

In Jenkins, I would like to execute my scriptler script via REST API from bash and curl. According to documentation it should work, but there isn't any working example.

I have created simple script testScr , which is just one liner: println "OK" . I'm trying to execute it with curl :

curl -d '{}' --user <userid>:<Token> http://<jenkins_server>/scriptler/run/testScr > result.html

Resulting html says: "Oops. A problem occurred while processing the request "

How to do it correctly? Is even it working for somebody?

Yes that works for me. Have you made sure that the user have the right permission and the token is corrct?

In my case I'm using Role-based Authorization Strategy

And you can execute it if you're admin

在此处输入图像描述

if you want another user different that admin execute it you can also grant permissions

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM