持续集成持续交付企业示例

一.jenkin对接harbor仓库

1.在harbor仓库中建立timinglee项目

2.在harbor主机中安装jenkins所需工具

复制代码
[root@harbor harbor]# dnf install fontconfig java-21-openjdk git -y

3.配置jenkins控制harbor构建镜像并上传

释放jenkins节点,让所有任务不在jenkins中执行

4.配置镜像构建节点

安装插件

构建设定

5.测试

复制代码
[root@code-node timinglee]# echo lee v1 > index.html
[root@code-node timinglee]# vim Dockerfile
FROM nginx:latest
COPY index.html /usr/share/nginx/html
[root@code-node timinglee]# git add  Dockerfile index.html
[root@code-node timinglee]# git commit  -m "webserver v1"
[main 8a096fe] webserver v1
2 files changed, 3 insertions(+)
create mode 100644 Dockerfile
create mode 100644 index.html
[root@code-node timinglee]# git push origin main

二.部署节点设定

1.安装docker环境

复制代码
[root@service yum.repos.d]# vim docker.repo
[docker]
name = docker ce
baseurl = https://mirrors.aliyun.com/docker-ce/linux/rhel/9.8/x86_64/stable/
gpgcheck = 0
[root@service yum.repos.d]# dnf install docker-ce -y
[root@service ~]# scp -r root@172.25.254.250:/etc/docker/* /etc/docker/
[root@service ~]# vim /etc/hosts
172.25.254.250     
reg.timinglee.org
[root@service ~]# scp /etc/docker/certs.d/reg.timinglee.org/ca.crt  /etc/pki/ca
trust/source/anchors/
[root@service ~]# update-ca-trust extract
[root@service ~]# systemctl enable --now docker
[root@service ~]# docker pull reg.timinglee.org/timinglee/webserver:latest
latest: Pulling from timinglee/webserver
1b985cc8f089: Pull complete
ec1a2ca4ac87: Pull complete
8b87c0c66524: Pull complete
55e54df86207: Pull complete
72db5db515fd: Pull complete
f4f00eaedec7: Pull complete
9853575bc4f9: Pull complete
5f0272c6e96d: Pull complete
5f0cbf67f1e9: Download complete
44136fa355b3: Download complete
Digest: sha256:c33cfee621199321accd0446d8420caea759805633d44e4d0e310ce0f4c6c7d0
Status: Downloaded newer image for reg.timinglee.org/timinglee/webserver:latest
reg.timinglee.org/timinglee/webserver:latest

2.安装插件

3.配置业务主机

4.利用jenkins调用业务主机

三. 测试

复制代码
[root@code-node timinglee]# echo lee v2 > index.html
[root@code-node timinglee]# git commit  -a -m "webserver v2"
[main c1b0f53] webserver v2
 1 file changed, 1 insertion(+), 1 deletion(-)
[root@code-node timinglee]# git push  origin main
#等待1分钟左右
[root@code-node timinglee]# curl  172.25.254.30
lee v2
相关推荐
FlightYe20 小时前
linux系统编程(二十一):C 语言常见坑
android·linux·运维·服务器·c语言·音视频
橙橙笔记1 天前
Linux基础与命令的学习
linux·运维·服务器·shell
无奈笑天下1 天前
银河麒麟桌面操作系统【命令行配置文件与图片搜索功能】操作方法
linux·运维·服务器
飞花漫卷,情随岁迁1 天前
网络数据包转发与内核机制:小白概念科普
linux·运维·网络·数据库·mysql·oracle·智能路由器
.道阻且长.1 天前
Linux基础IO:理解文件以及回顾C文件接口
linux·运维·服务器·c语言·开发语言·职场和发展
goehou1 天前
改错一行 fstab,SSH 就再也连不上了
linux·运维·故障恢复·fstab
贝锐1 天前
远程运维如何实现网页触达:制造企业引入向日葵SDK重构机床运维实战
运维·sdk·web
无奈笑天下1 天前
银河麒麟高级服务器操作系统【通过 sysctl 调整内核网络参数】操作方法
运维·服务器·网络
MSTcheng.1 天前
【LinuxIO篇】Linux学习第二十三弹——Linux重定向到底改了什么?printf为何会写进文件,一文搞懂fd与dup2
linux·运维·服务器·操作系统·重定向·文件描述符