1.gitlab-runner 安装
- https://docs.gitlab.com/runner/ 安装文档(推荐)
- 方法二(macOS):
//下载二进制文件 该地址为公司地址可选其他地址
sudo curl -L --output /usr/local/bin/gitlab-runner ftp://192.168.81.230/gitlab-runner/gitlab-runner-linux-amd64-12.4.0
//添加可执行权限
sudo chmod +x /usr/local/bin/gitlab-runner
//安装docker 可选
curl -sSL https://get.docker.com/ | sh
//增加gitlab-runner用户
sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
//使用服务的形式来运行runner
sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
sudo gitlab-runner start
2. gitlab-runner 注册
可以操作的ubuntu虚拟机:
ssh vagrant@192.168.81.217
现在进入页面
- 运行注册
sudo gitlab-runner register
- 输入你的GitLab URL
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
- 输入注册令牌来注册Runner
Please enter the gitlab-ci token for this runner
- 输入Runner说明
Please enter the gitlab-ci description for this runner
[hostame] my-runner
- 输入Runner的tag
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag,another-tag
- 执行方式
Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
shell
3.编写.gitlab-ci.yml集成
4.执行集成测试
5.项目迁移
git clone (ssh网址)
git remote add local(远程地址)
git push local
如果需要
添加分支
git checkout -b testing