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

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

转载于:https://my.oschina.net/jdragon/blog/491071

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值