【Gitlab】CICD使用minio作为分布式缓存

1、安装minio

下载适合自己系统版本的安装文件https://dl.min.io/server/minio/release/windows-amd64/

yum install xxx.rpm

2、配置/etc/profile

export MINIO_ACCESS_KEY=root ui登录账号

export MINIO_SECRET_KEY=minioDev@001 ui登录密码

export MINIO_OPTS="--address :9000 --console-address :9090"

--console-address 配置的ui端口,--address配置的api端口,上传文件就用这个地址

export MINIO_VOLUMES="/root/minio/data" 数据文件的存放处

3、启动

命令启动:

nohup minio server --address ':9000' --console-address ':9090' --config-dir /root/minio/config /root/minio/data > /root/minio/minio.log 2>&1 &

服务启动

配置: /usr/lib/systemd/system/minio.service ,使用服务配置就要配置上面的两个环境变量MINIO_OPTS 和 MINIO_VOLUMES

4、UI登录

5、创建访问key和密钥

6、安装客户端工具测试

wget https://dl.min.io/client/mc/release/linux-amd64/mc

chmod +x mc

mv mc /usr/bin/mc

创建别名,免得每次都要输入key,gitcicd gitcicdDev@001是创建的key

mc alias set myminio http://172.30.218.117:9000 gitcicd gitcicdDev@001

mc ls myminio/gitlab 桶名称

如果能返回这个桶里面的信息就说明ok了.

7、配置gitrunner,使用minio作为缓存

复制代码
[[runners]]
  name = "jtkj-shell"
  url = "https://xxx.xxx.xxx.22/gitlab"
  token = "glrt-jdu7VxeAR282TDEbbeaU"
  executor = "shell"
  tls-ca-file = "/etc/gitlab-runner/ca.crt" #因为gitlab用了自签名的证书,所以配置让gitrunner信任下
  [runners.custom_build_dir]
  [runners.cache]
    Type = "s3"  # 固定格式
    Shared=false # 配置不和其他项目共享缓存
    [runners.cache.s3]
      ServerAddress = "172.30.218.117:9000"  #记得这个地址不是http://x.x.x.x:9000格式,我这个gitrunner版本是:  version=14.6.0 ,我看网上很多教程都是有http的,测试后报错,
      AccessKey = "gitcicd"
      SecretKey = "gitcicdDev@001"
      BucketName = "gitlab"
      BucketLocation = "us-east-1"
      Insecure = true #就是可以支持minio不是https
    [runners.cache.gcs]
    [runners.cache.azure]

,如果上面的地址配置成:http://x.x.x.x:9000,gitrunner后台的报错日志如下:

意思就是冒号太多。

测试成功之后的cicd的信息:

相关推荐
IT大白鼠8 天前
GitLab 未认证 RCE 应急实战CVE-2026-97229(CVSS 10.0)
网络·安全·gitlab
71777714 天前
Git自建用什么工具比较好:Gitea、Forgejo、GitLab CE与Gitee的选型对比
git·gitlab·gitea
colinu16 天前
Create gitlab-runner
gitlab
master33617 天前
GitLab 10.x → 19.5.x 升级路线图
gitlab
长不大的杨瑞杰17 天前
OpenCode v2 GitLab 集成实战:Issue 驱动开发、MR 审查与 CI/CD 最小权限
人工智能·ci/cd·gitlab·ai编程·opencode
极小狐23 天前
极狐GitLab万人并发架构实践,大规模组织的扩容路线图
架构·gitlab·极狐gitlab
Lvan的前端笔记24 天前
GitLab CI 环境变量整理
ci/cd·gitlab
李迟25 天前
CICD实例:解决GitLab Runner无法执行CICD问题
gitlab
hanjq_code1 个月前
gitlab本地文件 跨分支 忽略改动 不提交
gitlab
极小狐1 个月前
极狐GitLab集群高可用方案,多节点架构与故障自愈实践
架构·gitlab·高可用·极狐gitlab