1、安装gitlab-runner
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh" | sudo bash
yum install gitlab-runner -y
2、注册gitlab
gitlab-runner register --url https://gitlab.xxxx.com(或者IP)/ --registration-token xxxx
# 在gitlab的组或项目中的设置-cicd-runner或获取:GitLab 地址
Enter the GitLab instance URL (for example, https://gitlab.com/):
> 输入gitlab的服务URL
# 输入 GitLab Token
Enter the registration token:
> 输入令牌,参考图中绿色部分所示
# 输入 Runner 的描述
Enter a description for the runner:
> 这里的描述也是 runner 的名称
# 设置 Tag,可以用于指定在构建规定的 tag 时触发 ci
Enter tags for the runner (comma-separated)
> test
# 输入可选维护说明
Enter optional maintenance note for the runner:
> runner 的描述内容,随便写
# 选择 runner 执行器,通常选择 shell
Enter an executor: docker+machine, docker-ssh+machine, custom, docker-windows, docker-ssh, ssh, kubernetes, docker, parallels, shell, virtualbox:
> shell
# 回车结束,安装gitlab-runner文件夹下会自动生成config.toml
3、安装yarn
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
yum install -y yarn
4、其他nodejs
npm config set registry https://registry.npm.taobao.org
npm install -g yarn
ln -s /home/gitlab-runner/nodejs/bin/yarn /usr/bin
npm install -g vue-cli
ln -s /home/gitlab-runner/nodejs/bin/vue /usr/bin
npm install -g vue/cli-service
ln -s /home/gitlab-runner/nodejs/bin/vue /usr/bin