gitlab 优化记录
2023年5月23日...小于 1 分钟
gitlab 优化记录
优化 runner
使用 docker 做runner 的时候,需要修改一下配置
在 /etc/gitlab-runner/config.toml
中 添加如下配置
allowed_pull_policies = ["always", "if-not-present"]
此操作的目录是让 docker 支持永远拉取最新镜像 always
,或者是不存在时才拉取 if-not-present
同时支持在 .gitlab-ci.yml
设置
image:
name: node:18.16.0-bullseye
pull_policy: if-not-present
pull_policy 的值必须在 config.toml 中 allowed_pull_policies
存在
gitlab-runner 的一些命令
cp gitlab-runner-linux-amd64 /usr/local/bin/gitlab-runner #拷贝
chmod +x /usr/local/bin/gitlab-runner #修改权限
useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash #添加用户
gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner #安装
gitlab-runner start #启动
gitlab-runner status #查看状态
gitlab-runner register --url https://gitlab.shuobude.top/ --registration-token $REGISTRATION_TOKEN # 注册
gitlab-runner unregister # 取消所有注册
https://gitlab.com/gitlab-org/gitlab/-/issues/21619
https://nixos.wiki/wiki/Gitlab_runner
https://nixos.wiki/wiki/Gitlab_runner
https://docs.gitlab.com/ee/ci/docker/using_docker_images.html
贡献者
change