jenkins-cron/readme.md
2025-05-09 17:40:44 +08:00

22 lines
830 B
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编译刷新缓存。
## 使用方法
* 前提 *
* 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使用的缓存目录