GitLab-CI
常用的一些 CI 脚本
· ☕ 3 分钟
由于负责小组的 CI 公共事项,经常需要配置 CI 流程,或者帮助其他人解决一些问题,整理了一下常用的 CI 脚本,以方便查阅。 1. .gitlab-ci.yml 结构 下面是, GitLab CI 的配置文件结构。 .gitlab-ci.yml 文件 1 2 3 4 5 6 7 8 9 10 11 12 13 14 # 一些前置脚本,完成激活环境等操作 before_script: - source /data/runner/node/bin/activate - which node && node --version - which npm

GitLab CI 配置 Runner
· ☕ 2 分钟
1. 下载并配置 Runner 1.1 下载 Runner GitLab-CI 的 Runner 是一个 Go 写的程序包,可以去官网下载到本地。 1 2 yum install -y wget wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64 增加执行权限 1 chmod +x /usr/local/bin/gitlab-runner 1.2 新增 runner 用户 运行 Runner 时,以 runner:runner 账户运行。 1 2 groupadd -g 1234 runner useradd runner -u 1234 -g 1234 1.3 修改 pip 源 1 2 3 4 cat /etc/pip.conf [global] index-url= http://pypi.doubanio.com/simple/ trusted-host = pypi.doubanio.com 1.4 创建工作目录 1 mkdir -p /data/gitlab-data 2 注册 Runner 在项目

GitLab CI 持续集成
· ☕ 3 分钟
1. 基本概念 GitLab-CI:GitLab 提供的持续集成系统,管理项目的构建状态,通过 GitLab Runner 来执行构建任务。 GitLab-Runner:用于执行构建任务,.gitlab-ci.yml 的 script 部分的运行就是由 GitLab-Runner 来完成。 .gitlab-ci.yml: