gitlab-cicd持续部署-保姆式基础教学
gitlab-cicd 是一个强大的自动化技术,支持任意规模的构建与测试
- 持续集成(CI) 由您开始。您在合并请求(MR)中共享新代码,并触发Pipeline。构建、测试和验证——极狐GitLab负责完成其余的工作。
- 持续交付 (CD) 将您的辛勤努力付诸实践,通过结构化部署Pipeline将经过CI验证的代码移交给您的应用程序。
环境:
linux centos7.9
基本配置
安装阿里云镜像源
[root@gitlab-cicd ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
[root@gitlab-cicd ~]# yum clean all
[root@gitlab-cicd ~]# yum makecache
安装相关依赖
[root@gitlab-cicd ~]# yum -y install policycoreutils openssh-server openssh-clients postfix
[root@gitlab-cicd ~]# yum -y install policycoreutils-python
[root@gitlab-cicd ~]# systemctl enable sshd && systemctl start sshd
[root@gitlab-cicd ~]# systemctl enable postfix && systemctl start postfix
关闭防火墙以及selinux
[root@gitlab-cicd ~]# systemctl stop firewalld && systemctl disable firewalld
[root@gitlab-cicd ~]# setenforce 0
[root@gitlab-cicd ~]# sed -i s/SELINUX=enforcing/SELINUX=disabled/g
gitlab-ce安装与操作
下载gitlab-ce软件
清华源包
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-15.6.2-ce.0.el7.x86_64.rpm
packageCloud(快很多)
https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-15.5.6-ce.0.el7.x86_64.rpm/download.rpm
[root@gitlab-cicd ~]# wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-15.5.6-ce.0.el7.x86_64.rpm/download.rpm
安装gitlab-ce
[root@gitlab-cicd ~]# rpm -ivh download.rpm
#或
[root@gitlab-cicd ~]