Git 提交后开始自动构建

设定Git仓库的钩子 一般路径为 xxx.git/hooks 参考文档 https://git-scm.com/docs/githooks

修改 post-receive

#!/bin/bash
while read oldrev newrev refname
do
    branch=$(git rev-parse --symbolic --abbrev-ref $refname)
    if [ "developer" == $branch ]; then
       echo 'start call jenkins'
       curl -s --user jenkins用户名:jenkins密码 JenkinsJObURL
       echo 'end call jenkins'
    fi
done

  

 

posted @ 2016-10-28 13:51  骨头  阅读(1096)  评论(0编辑  收藏  举报