环境:
server1:gitlab git
server2:jenkins git
gitlab安装:
已经写过了,省略,不会的看一下链接:
https://blog.csdn.net/su_use/article/details/81985217
jenkins安装:
[root@server2 jenkins]# ls
jdk-8u171-linux-x64.rpm jenkins-2.121.1-1.1.noarch.rpm
[root@server2 jenkins]# yum install *
[root@server2 jenkins]# /etc/init.d/jenkins start
Starting jenkins (via systemctl): [ OK ]
[root@server2 jenkins]# netstat -antlp
监听端口8080:
登陆:
[root@server2 jenkins]# cat /var/lib/jenkins/secrets/initialAdminPassword
a3d3ed8ddd904ee5a35fc19a456f2681
[root@server2 jenkins]#
复制粘贴密码:
安装默认插件:
创建一个名为testfile的自由软件项目:
git管理:
点击add,添加ssh
有个错误提示是git命令,需要安装git。
[root@server2 jenkins]# yum install git
构建触发器:
构建shell命令:
一个项目就OK了(每分钟刷新一次)
检测:
[root@server1 demo]# ls
oo README.md westos.txt
[root@server1 demo]# vim test
[root@server1 demo]# git add test
[root@server1 demo]# git commit -m "add test"
[master 36ab694] add test
Committer: root <root@server1.(none)>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
If the identity used for this commit is wrong, you can fix it with:
git commit --amend --author='Your Name <you@example.com>'
1 files changed, 3 insertions(+), 0 deletions(-)
create mode 100644 test
[root@server1 demo]# git push origin master
Counting objects: 4, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 330 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@172.25.5.1:root/demo.git
f5e1017..36ab694 master -> master
[root@server1 demo]#
检测到:
shell命令成功执行:
二,被动检测:(gitlab变更后自动通知变更)
插件安装:
安装好后,变更项目配置:
变更触发器,删除轮询。
高级->Generate 生成key
gitlab配置:
证书生成(有时间限制)
允许本地网络连接
jenkins连接认证
test一下
200提示表示正常
被动接受#3消息
docker插件使用
jenkins插件安装: