foreword
When we used Jenkins to integrate Gogs for continuous integration, we chose Jenkins to regularly check whether the git repository has been updated to decide whether to build. That is to say, Jenkins will not know immediately after we submit the code, so we can solve it through webhook. Jenkins' plugin center already has support for gogs, which is really nice.
Install the Gogs webhook plugin
Open System Management -> Manage Plugins -> Optional Plugins, enter "gogs" in the input box in the upper right corner to filter plugins:
Configure in gogs
- Enter our warehouse, click warehouse settings
2. Add webhook
Click Manage Web Hooks -> Add Web Hooks -> Select Gogs
Add the following configuration:
The format of the push address is:http(s)://<你的Jenkins地址>/gogs-webhook/?job=<你的Jenkins任务名>
3. Configure Jenkins
Go to the main panel, click on our task:
Choose a configuration:
Select Gogs Webhook to configure it according to your needs, if there is no key set then do nothing.
test
We go back to gogs, click push test, after the push is successful, we will see a push record
Going back to our Jenkins we can see that a build has been successful:
http://www.cnblogs.com/stulzq/p/8629720.html
foreword
When we used Jenkins to integrate Gogs for continuous integration, we chose Jenkins to regularly check whether the git repository has been updated to decide whether to build. That is to say, Jenkins will not know immediately after we submit the code, so we can solve it through webhook. Jenkins' plugin center already has support for gogs, which is really nice.
Install the Gogs webhook plugin
Open System Management -> Manage Plugins -> Optional Plugins, enter "gogs" in the input box in the upper right corner to filter plugins:
Configure in gogs
- Enter our warehouse, click warehouse settings
2. Add webhook
Click Manage Web Hooks -> Add Web Hooks -> Select Gogs
Add the following configuration:
The format of the push address is:http(s)://<你的Jenkins地址>/gogs-webhook/?job=<你的Jenkins任务名>
3. Configure Jenkins
Go to the main panel, click on our task:
Choose a configuration:
Select Gogs Webhook to configure it according to your needs, if there is no key set then do nothing.
test
We go back to gogs, click push test, after the push is successful, we will see a push record
Going back to our Jenkins we can see that a build has been successful:
http://www.cnblogs.com/stulzq/p/8629720.html