Objective
When we used the Jenkins collection gogs for continuous integration, Jenkins timed to detect if the Git repository was updated to determine whether to build. That is, we submit the code Jenkins does not immediately know, then we can solve by Webhook. Jenkins plug-in center already has the support to Gogs, really is very praise.
Https://plugins.jenkins.io/gogs-webhook
Installing the Gogs Webhook plugin
Open System Management--management plug-in, optional plug-in, enter "Gogs" in the input box in the upper-right corner to filter the plugin:
Configuring in Gogs
- Go to our warehouse and 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 and click on our task:
Select the configuration:
Choose Gogs Webhook to configure it according to your needs, if you do not set the key then nothing moves.
Test
We go back to Gogs, click on Push test, push success will see a push record
Back to our Jenkins you can see that a build has been successfully made:
Jenkins Configuration Gogs Webhook Plugin