jenkins-cron/readme.md
“xHuPo” 55f3e2b3c6 add v3
2025-05-22 11:43:23 +08:00

27 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 原理
jenkins-cron项目访问到jenkins使用gradle编译项目的缓存目录删除缓存目录中的文件达到清理缓存的目的。
触发jenkins中相应job编译刷新缓存。
## 版本说明
v1: 满足基本要求,清理缓存效率不高
v2: 优化,缓存清理效率提高;多次触发编译防止刷新缓存失败
v3特化新增特定参数即如果存在特定参数则这些特定参数需要分别执行一次构建如果不存在则只使用最近一次构建的参数执行构建
## 使用方法
* 前提 *
* 1. jenkins中对应的job需要配置布尔类型的only_build参数当该参数为true时仅编译不进行发布。 *
* 2. jenkins中对应的job中需要配置触发远程构建时的身份令牌目前只支持同一个身份令牌。 *
## 编译
```shell
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o jenkins-cron
```
## 打包镜像
```shell
docker build -t swr.cn-east-3.myhuaweicloud.com/turingsyn/ops/jenkins-cron:v1.9 .
docker push swr.cn-east-3.myhuaweicloud.com/turingsyn/ops/jenkins-cron:v1.9
```
## k8s使用
* 需要挂载gradle使用的缓存目录