Jenkins CI CD

原文:https://www.sunjianhua.cn/archives/jenkins-ci-cd.html

1.安装git

以下为简单应用,适合无gitlab服务器用户.

#在git服务器(192.168.2.163)
$ iptables F
$ useradd git
$ passwd git
$ su git
$ mkdir -p ./repos/app.git
$ cd ./repos/app.git
$ git --bare init && ls -a

#在其他机器上clone
$ git clone git@192.168.2.163:/home/git/repos/app.git
#在其他机器使用免秘钥登录
$ ssh-keygen #一路回车
$ ssh-copy-id -i .ssh/id_rsa.pub git@192.168.2.163:22

#在git服务器(192.168.2.163)
$ chmod 600 ~/.ssh/authorized_keys

在其他机器再次clone或者push就不需要密码了

2.安装jenkins

插件安装
权限管理插件: Role-based Authorization Strategy

jenkins-ci-cd1.png
jenkins-ci-cd2.png
jenkins-ci-cd3.png
jenkins-ci-cd4.png

参数化构建插件: Extended Choice Parameter

jenkins-ci-cd5.png

Git参数化构建插件: Git Parameter (例如自动选择分支)
jenkins-ci-cd-git-para.png

邮件通知插件: Email Extension plugin
系统管理中设置

3. Master-Slave 架构

jenkins-ci-cd7.png

4. 流水线

jenkins-ci-cd8.png

5. 自动化构建案例(Jenkins+Pipeline+Maven+Git+JAVA项目)

原文地址:https://www.cnblogs.com/shihaiming/p/9990493.html