gongdear

gongdear的技术博客

欢迎大家参观我的博客
  menu
99 文章
89355 浏览
1 当前访客
ღゝ◡╹)ノ❤️

gitlab-runner一些实用配置

config.toml 文件内容

concurrent = 8
check_interval = 0[session_server]
session_timeout = 1800[[runners]]
name = "docker-runner"
url = "{host}"
token = "{token}"
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "alpine:latest"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/var/run/docker.sock:/var/run/docker.sock","/cache","/data/gitlab-runner/cache:/root"]
pull_policy = "if-not-present"
shm_size = 0
volumes = ["/var/run/docker.sock:/var/run/docker.sock","/cache","/data/gitlab-runner/cache:/root"]

说明 大部分接触到的是 /root/.m2 和/root/.npm
之前配置的是

volumes = ["/var/run/docker.sock:/var/run/docker.sock","/cache","/data/gitlab-runner/cache/.m2:/root/.m2"]

后来加上了node的缓存

volumes = ["/var/run/docker.sock:/var/run/docker.sock","/cache","/data/gitlab-runner/cache/.m2:/root/.m2","/data/gitlab-runner/cache/.npm:/root/.npm"]

不如直接将root目录挂出来,这样docker login 和ssh公私钥等信息也默认有了

pull_policy = "if-not-present"

说明 默认没有这句话 没有这句话时默认为 pull_policy = "always"即每次都拉取执行任务的镜像 没必要且慢 而且有网络问题...

宝剑锋从磨砺出,梅花香自苦寒来.