最近在研究Jenkins部署Vue项目,公司代码管理平台使用的是Coding,所以对应的webhook插件是Coding WebHook Plugin,遇到的主要问题是在于使用插件后无法保存配置文件,点击保存无反应。在腾讯云上询问在线技术支持得到的答案是使用Generic Webhook trigger来替换Coding Webhook pugin
以下是Generic Webhook trigger使用方法
进入到Plugin Manager下载
进行配置
勾选Generic Webhook Trigger
重点(其他代码管理平台同理)
http://JENKINS_URL/generic-webhook-trigger/invoke JENKINS_URL替换为你自己的Jenkins地址,需要配置在Coding里的Webhook中
Coding配置
选择项目设置
找到Service Hook
新建一个Service Hook
配置Webhook
过滤条件以自身需求为主,可以不使用全部
服务URL中间码过的地方为你Jenkins Ip地址
用户名:Jenkins账号 密码:Jenkins密码
配置后可以点击测试查看是否自动部署成功。如果测试失败可以看看记录响应
以下是响应内容
{ "jobs": null, "message": "Did not find any jobs with GenericTrigger configured! If you are using a token, you need to pass it like ...trigger/invoke?token=TOKENHERE. If you are not using a token, you need to authenticate like http://user:passsword@jenkins/generic-webhook... " }
需要关注的是message响应的信息
如果没有使用token,只需要在之前Webhook配置页面中添加Jenkins用户名和密码即可
http://user:passsword@jenkins/generic-webhook/invoke 不需要按照这样配置服务URI