配置gitlab的web hook,当git库的某个分支有提交时,自动触发jenkins的job

原创
2015/08/12 10:18
阅读数 6.9K

jenkins是一个CI工具,其有个插件gitlab hook plugin,可以识别gitlab发送过来的提交信息,并触发对应的job。

配置功能:

  • jenkins上只需要配置源代码来自git地址,不需要任何额外的配置;
  • 在gitlab的某个项目的web hook配置中,配置固定的触发地址:http://your-jenkins-server/gitlab/build_now
  • 当gitlab的指定项目有push后,当push完成时,会触发指定的jenkins server上的对应job,匹配原则为:git project url地址一致,branch一致;

Build now hook

https://github.com/jenkinsci/gitlab-hook-plugin

Add this web hook on your GitLab project:

http://your-jenkins-server/gitlab/build_now

Plugin will parse the GitLab payload and extract the branch for which the commit is being pushed and changes made. It will then scan all Git projects in Jenkins and start the build for those that:

  • match url of the GitLab repo
  • match the configured refspec pattern if any
  • and match committed GitLab branch

Notes:

  • for branch comparison, it will take into account both the branch definition and the strategy (this is different from the original notifyCommit)
  • the project must be enabled
  • you don't have to setup polling for the project
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部