LoginSignup
24
25

More than 5 years have passed since last update.

Git の push にフックして Jenkins のビルド実行するメモ

Posted at

Jenkins に、以下を Git のリポジトリURLに指定したジョブがあるとする

ssh://<gituser>@<git-server-url>/path/to/Module/

そのジョブの設定で、「SCMをポーリング」にチェックを入れておく (スケジュールは特にいれなくていい)

git リポジトリ側で、 post-receive フックに以下を追記する

$ cd /path/to/.git/hooks
$ vi post-receive
curl http://<jenkins-server-url>/git/notifyCommit?url=ssh://<gituser>@<git-server-url>/path/to/Module/

push すると以下のような表示がでるようになり、url に指定したリポジトリ設定があるジョブがキックされるようになる。

$ git push Module master
remote: Scheduled polling of Module-git
To git@local-git.shanon.co.jp:/home/git/gitroot/Coco
24
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
24
25