CI/CD 是指持续集成(Continuous Integration)和持续部署(Continuous Deployment)或持续交付(Continuous Delivery)
1.1 持续集成(Continuous Integration)
持续集成是一种软件开发实践,团队成员频繁地将他们的工作集成到共享的代码仓库中。其主要特点包括:
-
频繁提交代码:开发人员可以每天多次提交代码,确保代码库始终保持最新状态。
-
自动化构建:每次提交后,自动触发构建过程,包括编译、测试、静态分析等。
-
快速反馈:如果构建失败或测试不通过,能够快速地向开发人员提供反馈,以便及时修复问题。
1.2 持续部署(Continuous Deployment)
持续部署是在持续集成的基础上,将通过所有测试的代码自动部署到生产环境中。其特点如下:
-
自动化流程:从代码提交到生产环境的部署完全自动化,无需人工干预。
-
高频率部署:可以实现频繁的部署,使得新功能能够快速地提供给用户。
-
风险控制:需要有强大的测试和监控体系来确保部署的稳定性和可靠性。
1.3 持续交付(Continuous Delivery)
持续交付与持续部署类似,但不一定自动部署到生产环境,而是随时可以部署。其重点在于确保软件随时处于可发布状态。
CI/CD 的好处包括:
-
提高开发效率:减少手动操作和等待时间,加快开发周期。
-
尽早发现问题:通过频繁的集成和测试,问题能够在早期被发现和解决。
-
降低风险:减少了大规模部署时可能出现的问题,提高了软件的质量和稳定性。
-
增强团队协作:促进团队成员之间的沟通和协作,提高团队的整体效率。
常见的 CI/CD 工具包括 Jenkins、GitLab CI/CD、Travis CI 等。这些工具可以帮助团队实现自动化的构建、测试和部署流程。
二 git工具使用
2.1 git简介
Git 是一个分布式版本控制系统,被广泛用于软件开发中,以管理代码的版本和变更。 主要特点:
-
分布式
-
每个开发者都有完整的代码仓库副本,这使得开发者可以在离线状态下进行工作,并且在网络出现问题时也不会影响开发。
-
即使中央服务器出现故障,开发者仍然可以在本地进行开发和查看项目历史。
-
-
高效的分支管理
-
Git 中的分支创建和切换非常快速和简单。开发人员可以轻松地创建新的分支来进行新功能的开发或修复 bug,而不会影响主分支。
-
合并分支也相对容易,可以使用多种合并策略来满足不同的需求。
-
-
快速的版本回退
-
如果发现某个版本存在问题,可以快速回退到之前的版本。
-
可以查看每个版本的详细变更记录,方便了解代码的演进过程。
-
-
强大的提交管理
-
每个提交都有一个唯一的标识符,可以方便地引用和查看特定的提交。
-
提交可以包含详细的提交信息,描述本次提交的更改内容。
-
-
支持协作开发
-
开发者可以将自己的更改推送到远程仓库,供其他开发者拉取和合并。
-
可以处理多个开发者同时对同一文件进行修改的情况,通过合并冲突解决机制来确保代码的完整性。
-
Git必看秘籍:Git - Book
2.2 git 工作流程
Git 有三种状态:已提交(committed)、已修改(modified) 和 已暂存(staged)。
-
已修改表示修改了文件,但还没保存到数据库中。
-
已暂存表示对一个已修改文件的当前版本做了标记,使之包含在下次提交的快照中。
-
已提交表示数据已经安全地保存在本地数据库中。
这会让我们的 Git 项目拥有三个阶段:工作区、暂存区以及 Git 目录。
三 部署git
3.1 安装git
#在rhel9的系统中默认自带git
[root@gitlab ~]# dnf install git -y
#设定命令补全功能
[root@gitlab ~]# echo "source /usr/share/bash-completion/completions/git" >> ~/.bashrc
[root@gitlab ~]# source ~/.bashrc
3.2 初始化
获取 Git 仓库通常有两种方式:
-
将尚未进行版本控制的本地目录转换为 Git 仓库。
-
从其它服务器克隆 一个已存在的 Git 仓库。比如: git clone
初始化版本库
[root@gitlab ~]# mkdir test
[root@gitlab ~]# cd test/
[root@gitlab test]# git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /root/test/.git/
#设定用户信息
[root@gitlab test]# git config --global user.name "luohailin"
[root@gitlab test]# git config --global user.email "[email protected]"
#查看当前文件状态
[root@gitlab test]# git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
[!WARNING]
.git目录是git跟踪管理版本库的,没事别瞎溜达
四 git的使用方法
4.1 常用方法
[root@gitlab test]# echo test1 > README.md
[root@gitlab test]# git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
README.md
nothing added to commit but untracked files present (use "git add" to track)
[root@gitlab test]# git status -s
?? README.md
[root@gitlab test]# git add README.md
[root@gitlab test]# git status -s
A README.md
[root@gitlab test]#
[root@gitlab test]# git commit -m "add README.md"
[master (root-commit) 415e349] add README.md
1 file changed, 1 insertion(+)
create mode 100644 README.md
[root@gitlab test]# git status -s
[root@gitlab test]# vim README.md
[root@gitlab test]# git status -s
M README.md
[root@gitlab test]# git checkout -- README.md
[root@gitlab test]# cat README.md
test1
[root@gitlab test]# echo test2 > README.md
[root@gitlab test]# git add README.md
[root@gitlab test]# git status -s
M README.md
[root@gitlab test]# git restore --staged README.md
[root@gitlab test]# git status -s
M README.md
[root@gitlab test]# git add README.md
[root@gitlab test]# git status -s
M README.md
[root@gitlab test]# git commit -m "update v1"
[master b276dad] update v1
1 file changed, 1 insertion(+), 1 deletion(-)
[root@gitlab test]# git status -s
[root@gitlab test]# echo test2 >> README.md
[root@gitlab test]# git add README.md
[root@gitlab test]# echo test3 >> README.md
[root@gitlab test]# git status -s
MM README.md
[root@gitlab test]#
[root@gitlab test]# git commit -m "update v2"
[master a3b6e50] update v2
1 file changed, 1 insertion(+)
[root@gitlab test]# git status -s
M README.md
[root@gitlab test]# echo test2 >> README.md
[root@gitlab test]# git diff
diff --git a/README.md b/README.md
index d587aa2..4000f57 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,4 @@
test2
test2
+test3
+test2
[root@gitlab test]# git commit -a -m "update v3"
[master a048cb9] update v3
1 file changed, 2 insertions(+)
[root@gitlab test]# touch test.txt
[root@gitlab test]# git add test.txt
[root@gitlab test]# git commit -m "add test.txt"
[master ecea43c] add test.txt
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 test.txt
[root@gitlab test]# git status -s
[root@gitlab test]# git checkout -- test.txt
[root@gitlab test]# ls
README.md test.txt
[root@gitlab test]# git rm test.txt
rm 'test.txt'
[root@gitlab test]# git status -s
D test.txt
[root@gitlab test]# git commit -m "delete test.txt"
[master ccd14e1] delete test.txt
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 test.txt
[root@gitlab test]# git status -s
[root@gitlab test]#
[root@gitlab test]# git log
commit ccd14e170616c5c85af7aee8af2a45b774ec888d (HEAD -> master)
Author: luohailin <[email protected]>
Date: Fri Sep 13 10:45:06 2024 +0800
delete test.txt
commit ecea43c45b7f4a3f3181c2f22cf6f79cc76efa7d
Author: luohailin <[email protected]>
Date: Fri Sep 13 10:43:26 2024 +0800
add test.txt
commit a048cb972ad3fc23fb9edcc2780b891eeff9ec39
Author: luohailin <[email protected]>
Date: Fri Sep 13 10:42:43 2024 +0800
update v3
commit a3b6e50837a06118129b3cc25f383f2f5c152ad0
Author: luohailin <[email protected]>
Date: Fri Sep 13 10:42:17 2024 +0800
update v2
commit b276dad652c0240fac0794e8658908d929816641
Author: luohailin <[email protected]>
Date: Fri Sep 13 10:32:10 2024 +0800
update v1
commit 415e349e0e22f2b995faf1af44e18f0570157555
Author: luohailin <[email protected]>
Date: Fri Sep 13 10:30:40 2024 +0800
add README.md
[root@gitlab test]# git reflog
ccd14e1 (HEAD -> master) HEAD@{0}: commit: delete test.txt
ecea43c HEAD@{1}: commit: add test.txt
a048cb9 HEAD@{2}: commit: update v3
a3b6e50 HEAD@{3}: commit: update v2
b276dad HEAD@{4}: commit: update v1
415e349 HEAD@{5}: commit (initial): add README.md
[root@gitlab test]# git reset --hard ecea43c
HEAD is now at ecea43c add test.txt
[root@gitlab test]# ls
README.md test.txt
4.2 git对于文件如何忽略
[root@gitlab test]# mkdir dir1/
[root@gitlab test]# touch dir1/.file2
[root@gitlab test]# git status -s
?? dir1/
[root@gitlab test]# echo .file1 > gitignore
[root@gitlab test]# git status -s
?? dir1/
?? gitignore
[root@gitlab test]# echo ".*" > gitignore
[root@gitlab test]# git status -s
五 gitlab代码仓库
5.1 gitlab简介
-
GitLab 是一个用于仓库管理系统的开源项目,使用 Git 作为代码管理工具,并在此基础上搭建起来的 web 服务。
-
GitLab 具有很多功能,比如代码托管、持续集成和持续部署(CI/CD)、问题跟踪、合并请求管理等。它可以帮助开发团队更好地协作开发软件项目,提高开发效率和代码质量。
官网:https://about.gitlab.com/install/
中文站点: GitLab下载安装_GitLab安装和配置_GitLab最新中文官网免费版下载-极狐GitLab
官方包地址:gitlab/gitlab-ce - Packages · packages.gitlab.com
5.2 gitlab 的部署实施
5.2.1 部署gitlab
部署gitlab需要内存大于4G
[root@gitlab ~]# yum install -y curl policycoreutils-python-utils.noarch openssh-server perl
[root@gitlab ~]# dnf install gitlab-ce-17.1.6-ce.0.el9.x86_64.rpm -y
5.2.2 配置gitlab
#修改配置文件
[root@gitlab ~]# cd /etc/gitlab/
[root@gitlab gitlab]# ls
gitlab.rb
[root@gitlab gitlab]# vim gitlab.rb
32 external_url 'http://172.25.254.80'
#修改配置文件后需利用gitlab-crt来生效,
[root@gitlab gitlab]# gitlab-ctl reconfigure
#执行命令成功后会把所有组件全部启动起来
5.2.3 登陆gitlab
用户名默认为 root
。如果在安装过程中指定了初始密码,则用初始密码登录,如果未指定密码,则系统会随机生成一个密码并存储在 /etc/gitlab/initial_root_password
文件中, 查看随机密码并使用 root
用户名登录。
[!WARNING]
注意:出于安全原因,24 小时后,
/etc/gitlab/initial_root_password
会被第一次gitlab-ctl reconfigure
自动删除,因此若使用随机密码登录,建议安装成功初始登录成功之后,立即修改初始密码。
[root@gitlab gitlab]# cat /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
# 1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
# 2. Password hasn't been changed manually, either via UI or via command line.
#
# If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
Password: 5EpE/FHHAg4TpfbUHF3nF0FgxdZKGwYw9zEDVokIoAw=
# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
登陆
设置语言
设置密码
5.3 在gitlab中新建项目
上传公钥到gitlab中
#生成sshd密钥
[root@gitlab ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:gshaxiWzXQJKXA+YhnB0SEpTONzaE52cTVca3oq69fw [email protected]
The key's randomart image is:
+---[RSA 3072]----+
|**%=+ =. o.. |
|+%o=o= .o + |
|+ * +.. o . |
| + X + . . |
| B + ..S. |
| + .. |
|. . . |
| o o |
| . o.E |
+----[SHA256]-----+
上传公钥到gitlab中
[root@gitlab ~]# cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxyo3k67e/Z+pU0AFFLJUgu667BV+85ZAjMNIzrWHpccPRhTOFe2uK2FvUglTbsvmq9rNAO008GtMKAKI7zvE7z/ARXJT3QBCt9jBlh2rsB/XXD0E06FmL4Tr9uqvqPIXiQUKeEhs0V8ihjSGcw5qJGSOG9MUtNog/k0mmFMGoDVNTk2amKoN4Bz0Iu3v1qs446ttK5VVJ/3NgUDZdbj+Z9/x0La9YoNur0N5rX+CTj43/J85mYwwVfph9/FbxMhnsCtZtgHe5k2cCtv/0NxZq1JogPYVfZc3bzUGfshVYZbnd9rWTsr9wHOX3idYXYWX/qN3D8wTqnFWoJA13OEG/XFgS/38c7q4Glx6FMSRoFQDYFm4RJemt2jZqHptsTbh243dttOSVkHt9tyrxhXc+MKBwnduFYV5IsIgxW3nutqIEEoOqsbNocGhinsbyNsadgfrPkt/G1jCWYHTUHshF+3nQ826TmYNqwNVZ5++kqE83yWjfCxx/IZdrHE9IW6c= [email protected]
下载项目
[root@gitlab ~]# git clone [email protected]:root/luohailin.git
Cloning into 'luohailin'...
The authenticity of host '172.25.254.100 (172.25.254.100)' can't be established.
ED25519 key fingerprint is SHA256:scFmiqWy2SgzB821cF+SXyLp/odzIzRYv1jPnVbScCk.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '172.25.254.100' (ED25519) to the list of known hosts.
remote: Enumerating objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 3 (from 1)
Receiving objects: 100% (3/3), done.
[root@gitlab ~]# cd luohailin/
[root@gitlab luohailin]# ls
README.md
[root@gitlab luohailin]# git remote -v
origin [email protected]:root/luohailin.git (fetch)
origin [email protected]:root/luohailin.git (push)
#文件提交
[root@gitlab luohailin]# echo luohailin > luohailin
[root@gitlab luohailin]# git add luohailin
[root@gitlab luohailin]# git commit -m "add luohailin"
[main b2740e8] add luohailin
1 file changed, 1 insertion(+)
create mode 100644 luohailin
[root@gitlab luohailin]# git push -u origin main
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 276 bytes | 276.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To 172.25.254.100:root/luohailin.git
d33a57a..b2740e8 main -> main
branch 'main' set up to track 'origin/main'.
六 jenkins
6.1 jenkins 简介
-
Jenkins是开源CI&CD软件领导者, 提供超过1000个插件来支持构建、部署、自动化, 满足任何项目的需要。
-
Jenkins用Java语言编写,可在Tomcat等流行的servlet容器中运行,也可独立运行
CI(Continuous integration持续集成)持续集成强调开发人员提交了新代码之后,立刻进行构建、(单元)测试。
CD(Continuous Delivery持续交付) 是在持续集成的基础上,将集成后的代码部署到更贴近真实运行环境(类生产环境)中
6.2 部署 jenkins
软件下载:Download and deploy
jenkins需要部署在新的虚拟机中
[!WARNING]
jenkins需要部署在新的虚拟机中,建议最少4G内存,4核心cpu
#安装依赖包
[root@jenkins ~]# yum install fontconfig java-17-openjdk git -y
#安装jenkins
[root@jenkins ~]# yum install jenkins-2.462.2-1.1.noarch.rpm -y
#启动jenkins
[root@jenkins ~]# systemctl enable --now jenkins.service
Created symlink /etc/systemd/system/multi-user.target.wants/jenkins.service → /usr/lib/systemd/system/jenkins.service.
#查看原始密码
[root@jenkins ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
366044bcf46f4fb89ad7324f51338121
部署插件
[!NOTE]
建议修改admin的密码,在admin的设置中修改即可
6.3 jenkins 与gitlab的整合
[root@jenkins ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:0OvjDgxTV4ySUXcfyp+4WjY5hVfq4e0wR+90jMVv2wI [email protected]
The key's randomart image is:
+---[RSA 3072]----+
| .+.oo . . |
| o..o.o o . |
| o.o o . .|
| . o . + = |
| o S o B +|
| + . EB Bo|
| o o B.* X|
| o . + o.O+|
| .o . o+|
+----[SHA256]-----+
#看私钥
[root@jenkins ~]# cat /root/.ssh/id_rsa
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEAu78hn2ufa0Gxvbfc9HN30I3GkwtGZV4hmB2FnLyzMvIGkQ8mpU8Y
Ap1JPpXQ5tfraT2awxHv34I1PFPbS+UQ1tv3uOiLEgHyJFBolJZ1ysf3jrZEVr3qalRVup
66xUrSbll95W12H5pvwK0JvDh4filbGoBbVWqCmK4ZTP0q2xcy+XiDKybK4Xzn4eqWbfFt
bQd5qf5uNnD4+pECmv1Iw76PX7F/HqDzzZfw9pn/CTebxymxWPBA0nM/9yF7YuMi6m0wpS
PARCDMC2O3F8iMchVySL/EJvRqJ3zI0Zdc5Q/Gd4q7c0f3B8yGjIP7qRSXMEIUEhXpsBY+
2NdAY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
添加密钥凭据
添加完成后报错依然存在,因为ssh首次连接主机是需要签名认证,需要手动输入yes
还有两太主机之间一定要做好解析
[root@jenkins ~]# vim /etc/ssh/ssh_config
Host *
StrictHostKeyChecking no
标签:集成,md,git,CICD,gitlab,持续,README,test,root
From: https://blog.csdn.net/luohailin_/article/details/142203280