Run Jenkins build when git commit is done

核能气质少年 提交于 2019-12-22 08:04:03

问题


I know that this question is posted in different topic.But my case is a little bit different.

I want to trigger my test goal when a commit is detected by Jenkins. Most tutorials in the internet show how to do this using WebHook.

In my case I have two problems :

1) I did not find the option "Trigger build when a commit is detected"

2) All tutorials speak about configuring webhook, from Git URL.in my case, my git repository is local and I did not have access to the web interface. So how to do the same thing manually ?

Thank ou in advance

Configuration :

  • Jenkins Server 1.651.1
  • Git Plugin 2.4.4,

回答1:


You do it in a little bit different way:

You do use a web-hook to capture when new git commit was made and in the hook you start the Jenkins job with the rest API.

https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API

Read all about it in here:

http://kohsuke.org/2011/12/01/polling-must-die-triggering-jenkins-builds-from-a-git-hook/



来源:https://stackoverflow.com/questions/36936521/run-jenkins-build-when-git-commit-is-done

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!