跳至主要內容

gitlab 优化记录

Change Lee...小于 1 分钟gitlabgitlab

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/21619open in new window

https://nixos.wiki/wiki/Gitlab_runneropen in new window

https://nixos.wiki/wiki/Gitlab_runneropen in new window

https://docs.gitlab.com/ee/ci/docker/using_docker_images.htmlopen in new window

上次编辑于:
贡献者: change
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v3.1.3