jenkins自动构建403报错解决方案

报错:

Error 403 No valid crumb was included in the request

解决方案1:

在系统管理 –> 全局配置安全中调整设置:
取消“防止跨站点请求伪造”的勾选

解决方案2:

勾选“防止跨站点请求伪造”
获取Jenkins-Crumb

wget -q --auth-no-challenge --user USERNAME --password PASSWORD --output-document - 'http://IP:PORT/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)'

更换USERNAME PASSWORD IP:PORT
更改项目配置,勾选'参数化构建',添加字符参数,默认值为获取到的Jenkins-Crumb值

参考:

https://wiki.jenkins.io/display/JENKINS/Remote+access+API#RemoteaccessAPI-CSRFProtection

报错:

Authentication required
<!--
You are authenticated as: anonymous
Groups that you are in:

Permission you need to have (but didn't): hudson.model.Hudson.Read
 ... which is implied by: hudson.security.Permission.GenericRead
 ... which is implied by: hudson.model.Hudson.Administer
-->

解决方案:

在系统管理 –> 全局配置安全中调整设置:
勾选“匿名用户具有可读权限”