Jenkins Jack使用过程中报错
“jenkins jack: job.config: forbidden”
或则“jenkins:job.get:service unavailable”
解决方案
需要关闭jenkins的CSRF。
官方issue:https://github.com/tabeyti/jenkins-jack/issues/38
如下:
Jenkins 2.222.1 :
Always enabledCSRF
Protection
Jenkins will automatically enable CSRF protection with the default crumb issuer if it was disabled before. The ability to not have CSRF protection enabled has been deprecated and removed from the UI.
API clients should authenticate using API tokens, which doesn’t require CSRF crumbs since 2.96.
老版本(2.204.6以下)
在Jenkins界面“Manage Jenkins”->Security “Configure Global Security”->CSRF 中关闭
新版本
linux
修改文件vim /etc/sysconfig/jenkins
,搜索JENKINS_JAVA_OPTIONS
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true"
windows
在Jenkins安装目录,修改文件jenkins.xml
,在41排左右
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>
再运行就能看到成功的消息了