分支名称
已经有分支了
删除这个分支
新建分支
image.png
image.png
安装着两个插件
取消,这个
image.png
root@web1:/var/lib/jenkins/workspace/linux-36-job1# systemctl restart jenkins.service
重启jenkins服务
重命名
创建项目
image.png
克隆链接
image.png
选择分支为develop
jenkins 配置构建触发器
生产 token 认证
root@web1:/var/lib/jenkins/workspace/linux-36-job1# openssl rand -hex 12
9ea87932f0762b928a3f2585
image.png
把url写全放在这里
保存
root@web1:/var/lib/jenkins/workspace/linux-36-job1# grep 9ea87932f0762b928a3f2585 /var/lib/jenkins/ -R
/var/lib/jenkins/jobs/linux36-job1-develop/config.xml: <authToken>9ea87932f0762b928a3f2585</authToken>
是放在这个目录里
在浏览器访问这个地址就会重新构建任务
image.png
访问这个网站,这样就实现代码自动部署
http://173.22.90.19:8080/job/linux36-job1-develop/build?token=9ea87932f0762b928a3f2585
image.png
增加钩子
image.png
点击测试必须返回201
image.png
使用http克隆
root@gitlab:/opt# git clone -b develop http://173.22.90.18/linux36/web1.git
克隆指定分支
root@gitlab:/opt# cd web1/
添加一行为v7
root@gitlab:/opt/web1# vim index.html
linux36 web1 v7
root@gitlab:/opt/web1# git add index.html
root@gitlab:/opt/web1# git commit -m "v7"
root@gitlab:/opt/web1# git config --global user.email
root@gitlab:/opt/web1# git config --global user.email 50589143@qq.com
root@gitlab:/opt/web1# git push
Username for 'http://173.22.90.18': user1
Password for 'http://user1@173.22.90.18':
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 266 bytes | 266.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote:
remote: To create a merge request for develop, visit:
remote: http://173.22.90.18/linux36/web1/merge_requests/new?merge_request%5Bsource_branch%5D=develop
remote:
To http://173.22.90.18/linux36/web1.git
68e26d5..80539b1 develop -> develop
一提交就触发jenkins
这种功能不能陪在在生成环境,配置测试环境可以
image.png