gitlab-runner配置cache

gitlab-runner添加缓存minio
1. 部署minio

2. 配置runner连接minio
kubectl create secret generic s3access --namespace=gitlab-runner --from-literal=accesskey="AKIAIOSFODNN7EXAMPLE" --from-literal=secretkey="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"

values.yaml添加配置

cache:
    cacheType: s3
    cachePath: "gitlab-runner"
    cacheShared: true
    s3ServerAddress: "10.170.130.240:9897"
    s3BucketName: gitlab-ci-runner-cache
    s3BucketLocation:
    s3CacheInsecure: true
    secretName: s3access
cacheType: 缓存的类型,指定s3

cachePath:缓存路径,值得是bucket中的目录。可以自定义。

CacheShared:是否共享,如果存在多个runner则需要开启。

s3ServerAddress:S3服务器地址,minio域名。

s3BucketName:S3 bucket的名称,参考上面我们创建的名称。

s3BucketLocation:Location 默认即可,可选。

s3CacheInsecure:是否使用https。(这里官方chart有问题,配置的是不管是true还是false都是true,后面会修改)

secretName:凭据名称, 我们在上面创建的s3凭据。
3. .gitlab-ci.yml使用cache

可以配置全局缓存,也可以配置单job缓存

build_cicd:
  stage: k8s-cicd
  image: repository.bde.local/gitlab-runner/angular-docker-git:0.1
  cache:
    key: ${CI_PROJECT_NAME}-develop
    paths:
      - node_modules/

缓存默认策略为拉取上传,可以单配置拉取

build:
  stage: docker-run
  image: repository.bde.local/gitlab-runner/angular-docker-git:0.1
  cache:
    paths:
      - node_modules/
    policy: pull

设置某些job不使用cache

build:
  stage: docker-run
  image: repository.bde.local/gitlab-runner/angular-docker-git:0.1
  cache: {}

参考:http://blog.404mzk.com/gitlab/gitlab-runner-huan-cun-ji-zhi.html

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值