首页 系统 搭建Gitlab CI持续集成环境入门步骤

搭建Gitlab CI持续集成环境入门步骤

简单介绍Gitlab CI的功能
从GitLab 8.X 开始,GitLab CI就已经集成在GitLab中,我们只要在项目中添加一个.gitlab-ci.yml文件,然后添加一个Runner,开启Runner,即可进行持续集成。而且随着GitLab的升级,GitLab CI变得越来越强大。
GitLab Runner
在没使用过Gitlab之前,我也有一个困惑,到底Gitlab Runner是什么东西、它的作用是什么?GitLab Runner就是来执行这些构建任务的
而此时又会多了一个困惑,Gitlab CI不是也是用来运行构建任务的吗?一般来说,构建任务都会占用很多的系统资源(譬如编译代码),而GitLab CI又是GitLab的一部分,如果由GitLab CI来运行构建任务的话,在执行构建任务的时候,GitLab的性能会大幅下降。GitLab CI最大的作用是管理各个项目的构建状态,因此,运行构建任务这种浪费资源的事情就交给GitLab Runner来做拉!因为GitLab Runner可以安装到不同的机器上,所以在构建任务运行期间并不会影响到GitLab的性能。
1、首先部署安装Gitlab
ASP站长网首先安装git
yum install -y git
 
安装Gitlab依赖
yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-Python
 
启动ssh,postfix并设置开机启动和配置防火墙规则
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd –permanent –add-service=http
sudo systemctl reload firewalld
 
下载安装Gitlab
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
yum install gitlab-ce
 
修改Gitlab配置,将external_url变量地址改为自己域名或IP地址
vim  /etc/gitlab/gitlab.rb
 
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
external_url 'http://gitlab.test.com'
 
## Roles for multi-instance GitLab
 
重新启动加载配置文件
gitlab-ctl reconfigure
gitlab-ctl restart
 
可以netstat -ntlp查看启动的服务及端口(可以看出已经启动了nginx服务及端口为80端口,所以可以直接访问前面配置的域名或IP地址)

关于作者: dawei

【声明】:九江站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

热门文章