gitlab-runner 修改默认的builds_dir并使用custom_build_dir配置
- 1. 说明
- 2. 实操(以docker执行器为例)
- 2.1 修改默认的builds_dir
- 2.1.1 调整gitlab-runner的配置文件
- 2.1.2 CI文件
 
 
- 2.2 启用custom_build_dir
- 2.2.1 调整gitlab-runner的配置文件
- 2.2.2 CI文件
- 2.2.3 runner中查看builds_dir目录
 
 
 
参考链接
builds_dir 默认路径
custom_build_dir runner配置
Custom build directories
1. 说明
涉及到两部分:
-  
  - 修改默认的builds_dir
 
-  
  - 启用custom_build_dir
 
2. 实操(以docker执行器为例)
2.1 修改默认的builds_dir
2.1.1 调整gitlab-runner的配置文件
...
...
[[runners]]
  ...
  ...
  executor = "docker"
  builds_dir = "/root/codes"
  ...
  ...
gitlab-runner  verify #校验配置文件
2.1.2 CI文件

image: busybox:latest
build1:
  stage: build
  script:
    - echo $CI_BUILDS_DIR
    - echo "Do your build here"
    - sleep 600s
  tags:
    - vm100
2.1.3 runner中查看builds_dir目录

2.2 启用custom_build_dir
2.2.1 调整gitlab-runner的配置文件
[[runners]]
  ...
  ...
  executor = "docker"
  builds_dir = "/root/codes"
  [runners.custom_build_dir]
    enabled = true
  ...
  ...
gitlab-runner  verify #校验配置文件
2.2.2 CI文件
image: busybox:latest
variables:
  GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_PROJECT_NAME-$CI_COMMIT_BRANCH
build1:
  stage: build
  script:
    - echo $CI_BUILDS_DIR
    - echo "Do your build here"
    - sleep 600s
  tags:
    - vm100

2.2.3 runner中查看builds_dir目录




















