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

一.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
相关推荐
木头左10 小时前
【Nginx】内网服务源 IP 白名单实战:动态域名解析放行网段 + 端口接管零改造
运维·nginx·白名单·反向代理
禁默11 小时前
启元 Q1 二次开发实践:Ubuntu 部署与仿真验证,从 PrimeConsole 到 ROS 2 Humble + RViz
linux·运维·ubuntu
skywalk816311 小时前
把 去也网站 从 Ubuntu 搬到 FreeBSD:一次 Service Jail + nginx 的部署实录
linux·运维·nginx·ubuntu·freebsd
翔云12345612 小时前
RocksDB中,客户端每写入一次数据,需要访问几次磁盘
运维·数据库·mysql
爱莉希雅&&&13 小时前
GitLab 完整学习笔记
linux·运维·服务器
小杨爱科普15 小时前
制造业上自动化改造,改造部分的专利到底归谁
运维·经验分享·自动化
方便面不加香菜16 小时前
Docker Container --容器及容器的操作案例详解
运维·docker·容器
AR-26710-20 小时前
Linux Day32——实操五类资源告急排查
linux·运维
pengdott20 小时前
Rocky linux9安装最新版sonarqube-26.10.0
ci/cd·devops·sonarqube
skywalk816320 小时前
hive 常驻集群:像 OSPF 一样在线,像 git 一样可信
运维·人工智能·hive