Jenkins+Github实现自动触发构建
Github中获取访问token值,需要一个对项目有写权限的账户
GitHub->setting->Developer setting->Personal access tokens->点击Generate new token
内容填写如下:
复制生成的access token
Jenkins中Github配置中添加token凭证
系统管理 -> 添加Github server -> 添加Secret text凭证 -> 连接测试
同时,勾选为github指定另外一个hook url(配置Jenkins在Hook URL中监听Github的Post请求,然后进行自动构建)
注意:在操作过程,点击连接测试,可能会提示:Failed to validate the account,首先请确保添加凭证的类型是Secret text,其次secret值填写的是步骤1中生成的token值
Github中项目配置webhook
settings -> webhooks -> Add webhook
jenkins项目中进行配置