Jenkins + Gitlab submit implement automatic deployment configuration Webhook

 

I. Overview

In the previous article, the following link:

https://www.cnblogs.com/xiao987334176/p/11434849.html

 

Has achieved Jenkins + harbor + gitlab + k8s automatic deployment, but when the final release is manual.

Now you need to realize there is a time when the GitLab submit events, Jenkins can trigger the appropriate action, such as: automatic build and deploy.

 

Two, Jenkins configuration

Gitlab Hook plug-in installation

Log in background, click  the Manage Jenkins -> the Manage Plugins , search keywords Gitlab Hook

 

 Then click on the following direct installation

 

Setting project

Click already created project test-maven, click Configuration

 

 

勾选Build when a change is pushed to GitLab. GitLab webhook

Behind the url, when gitlab set webhook, will be used

Click the Advanced

 

 

Click the Generate button, token will be generated automatically.

This token, when gitlab set webhook, will be used

 

 

Click the Save button

 

 

Three, Gitlab configuration

Network Settings

Click Settings

 

 

Select the network, to expand the options

 

 

Check permission, click Save

 

 

This step must be done, otherwise when you add Webhook, will complain

Url is blocked: Requests to localhost are not allowed

 

Project Settings

Find items springbootdemo, click Settings -> Integration

 

 

Enter the url and token

Check the default push events, meaning that the project occurred when git push event will inform Jenkins grab the code and build

 

 

 

 

 After the addition is complete, click on the push events, it will simulate a push events events

 

 

Page will be prompted to send a request success

 

 

Wait a few seconds, Jenkins will trigger a task

 

 

Description, Jenkins + Gitlab Webhook arranged substantially completed.

 

Fourth, test the submission

Modify README.md the code, submit a

 

 

Wait for 8 seconds, it will trigger a task

 

 

It will eventually build.

 

 

 

 

Text reference links:

https://www.jianshu.com/p/6e12427a0838

 

Guess you like

Origin www.cnblogs.com/xiao987334176/p/11443002.html