CICD简介

1、CI/CD:持续集成(Continuous Integration)和持续部署(Continuous Deployment)的简称。实现CI与CD服务有:Jenkins(功能强大)、Gitlab、Drone(轻量级)。我们公司现在用的是前两个。

代码流转过程,即CICD的过程,我们公司也是采用的如下流程,

程序员将自己的代码提交到gitlab,然后部署平台触发jenkins进行编译与生成镜像,将镜像提交到HarBor上。测试人员负责将相应的镜像pull到机器并部署到docker容器中,在接口进行测试。

公司的CICD实现:

CICD流程:

11111111111111111111开始
构建id:1219969版本qa19.0722.1910.26未生成镜像,成功触发CI服务,镜像生成中
Started by user anonymous
Building remotely on node-10.110.44.91 in workspace /data/jenkinsslave/workspace/daoke_XXX
22222222222222222222——git命令开始拉取代码> git fetch --tags --progress git@git.XXXXX.git +refs/heads/*:refs/remotes/origin/*3333333333333333333333——开始解析pom,更新maven工具,下载依赖,开始编译打包
First time build. Skipping changelog.
Parsing POMs
Modules changed, recalculating dependency graph
Established TCP socket on 35729
maven33-agent.jar already up to date
maven33-interceptor.jar already up to date
maven3-interceptor-commons.jar already up to date
444444444444444444444444——开始构建镜像
[daoke_XXX] $ docker build --build-arg envType=qa --network=host -t docker.XXX/itlsaqa/XXXX:qa19.0722.1910.26 --pull=true /data/jenkinsslave/workspace/daoke_XXX
Sending build context to Docker daemon  371.5MB
Step 1/8 : FROM docker.XXX.com/base/tomcat:v8_jdk8
v8_jdk8: Pulling from base/tomcat
Digest: sha256:b44470d59808af877dcd8e60b5ddf5ff24c3416b6b27cb07f2f79382cf341553
Status: Image is up to date for docker.XXX.com/base/tomcat:v8_jdk8---> 9a32e706ff09
Step 2/8 : COPY dist/XXX.war /usr/local/tomcat/webapps/---> 0a1e193482a1
Step 3/8 : COPY hosts /tmp/hosts---> 4f636b111aed
Step 4/8 : USER root---> Running in 07316f8031fd---> 1446312bfaac
Removing intermediate container 07316f8031fd
Step 5/8 : CMD cat /tmp/hosts >/etc/hosts && source /script/init.sh && /usr/local/tomcat/bin/catalina.sh run---> Running in c305ffdb2ea0---> e8470d3ede68
Removing intermediate container c305ffdb2ea0
Step 6/8 : ARG envType---> Running in a5620a338843---> 786a81658933
Removing intermediate container a5620a338843
Step 7/8 : ADD http://docker.XXX.com/download/apmagent/apm.agent_${envType}.tar.gz /usr/local/apm_agent/apm.agent.tar.gz---> c10090e5588e
Step 8/8 : RUN tar -xzf /usr/local/apm_agent/apm.agent.tar.gz -C /usr/local/apm_agent/---> Running in 4b8bc5b606ef
555555555555555555555——推送镜像,镜像中包含了应用的war包、tomcat、JDK等一些依赖
[daoke_XXX] $ docker push docker.XXX.com/itlsaqa/XXX:qa19.0722.1910.26镜像生成成功
调度器正在选择发布到对应节点... 666666666666666666666666666——开始拉取镜像到宿主机上启动容器开始 pull 到10.110.44.106
10.110.44.106(64774) 镜像:docker.XXX.com/itlsaqa/XXX:qa19.0722.1910.26 pull 到 10.110.44.106 成功。 10.110.44.106(64774) 容器下负载反馈:项目:XXX

 

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注