First, the prerequisite steps
1, installation Gitlab
Yum-y Install policycoreutils openssh-server openssh-clients postfix
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-8.17.0-ce.0.el6.x86_64.rpm
RPM-IVH gitlab-ce-8.17.0-ce.0.el6.x86_64.rpm
Vi/etc/gitlab/gitlab.rb
Modified to native IP External_url ' http://10.120.52.22 '
Gitlab-ctl Reconfigure
Gitlab-ctl restart
Gitlab-ctl Status Query state
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/15/4e7217518547b881c7eae4e44577b55e.png-wh_500x0-wm_3 -wmp_4-s_798187850.png "title=" qq picture 20171115171306.png "alt=" 4e7217518547b881c7eae4e44577b55e.png-wh_ "/>
Access Address: http://10.120.52.22
2. Installation of Jenkins Continuous integration
wget Https://mirrors.tuna.tsinghua.edu.cn/jenkins/war/2.90/jenkins.war
Start Jenkins
Java-jar Jenkins.war &
Access Address: http://10.120.52.42:8080
Second, the idea
In the context of the Python Flask Web development environment, after committing the code through git to Gitlab, and then using Jenkins remote to Gitlab build code to publish to the test server
Three, Gitlab configuration
1, login Gitlab above, create Project:flask-demo
2. In SSH Keys on the menu bar, add the ssh-key of the development environment IP
3, login The development environment IP, clone git address
# git clone [email protected]:usercenter/flask-demo.git
# cd Flask-demo Create test file web.py
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/15/47b5e515b918766fab451c5cff718024.png-wh_500x0-wm_3 -wmp_4-s_3222441448.png "title=" qq picture 20171115172322.png "alt=" 47b5e515b918766fab451c5cff718024.png-wh_ "/>
4. Upload Update code
git status
git Add.
Git commit-m "new file web.py"
Git push Origin Master
Four, Jenkins Configuration
1, Login http://10.120.52.42:8080/console
2, in the System Management-management plug-in, install SSH2 easy Plugin plugin after reboot
3, create Project Flask demo, add Gitlab address, remote server IP and other information, as follows
650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/15/d0e117d7e1aa94e527167f9e26447583.png-wh_500x0-wm_3 -wmp_4-s_2629394435.png "title=" qq picture 20171115173648.png "alt=" D0e117d7e1aa94e527167f9e26447583.png-wh_ "/>
650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/15/cbb03ec8132db827a35842ef02a80df4.png-wh_500x0-wm_3 -wmp_4-s_1885242868.png "title=" qq picture 20171115173648.png "alt=" Cbb03ec8132db827a35842ef02a80df4.png-wh_ "/>
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/15/4bb7474bbd70ba48509b097ced5cf0f8.png-wh_500x0-wm_3 -wmp_4-s_2741617620.png "title=" qq picture 20171115173648.png "alt=" 4bb7474bbd70ba48509b097ced5cf0f8.png-wh_ "/>
4. System Management-System configuration
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/15/f46822b8ce8b185aedfe245e187ac11a.png-wh_500x0-wm_3 -wmp_4-s_2236870390.png "title=" qq picture 20171115173341.png "alt=" F46822b8ce8b185aedfe245e187ac11a.png-wh_ "/>
5. Build code in project to verify that the remote service is updated
This article is from the "Tiandaochouqin" blog, make sure to keep this source http://4543647.blog.51cto.com/4533647/1982091
Jenkins automation launches Python flask simulation process