Host a builds Gitlab.
Gitlab Download: https://www.gitlab.cc/downloads/(gitlab Chinese web)
Host B builds Jenkins
Jenkins Download: https://jenkins.io/index.html (Gitlab website)
Download Openssl-server at both ends
Gitlab the end of the build, create a project. First you need to configure the public key of Jenkins on the Gitlab side.
Locate the Deploy keys in the settings
Generate a pair of keys with the Jenkins user using the ssh-keygen-t RSA command on the Jenkins server. Copy the contents of the ~/.ssh/id_ras.pub key and write the title casually.
Addkey added.
Jeckins side is built in the browser directly enter the IP port number can be accessed, the port default 8080. Create a new project on Jenkins. Click on Project Click Configuration
The repository Url for this place is the SSH address of the project, as in that case.
The address of the red pigment circle is copied down.
The address of the copy above is glued to the location of the URL in the settings-->webhooks of the Gitlab side, secret token can not be filled. The following event is selected, where the push is selected, the Master branch is written, and the master branch triggers the build when it has a push. Click the bottom button add Webhook.
This position writes the command that was executed after the build was triggered. When the build succeeds, Jenkins will copy the code from the Gitlab into the Jenkins server, and the directory that is in the project is the catalog.
Jenkins is powerful, and there are many other features. such as sending mail after successful build.
Jenkins for automatic deployment