Git-+-Jenkins-提交Git-触发Jenkins-Job
利用git的Hook机制
- .git/hooks/pre-push
1
2
3!/bin/bash
echo ====== trigger jenkins job: maglev-verify in 10s =======
(sleep 10 && .git/hooks/post-push) & - .git/hooks/post-push
1
2
3!/bin/bash
branch=$(git rev-parse --abbrev-ref @{upstream})
curl -k --user ${USER}=${TOKEN} http://${JENKINS_URL}/job/${JOB_NAME}/buildWithParameters --data-urlencode TAG=$branch
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Michael Blog!
评论