添加 jenkins-cron.yaml

This commit is contained in:
iProbe 2025-05-09 17:44:42 +08:00
parent eaffb8f1f6
commit 43dea1c032

86
jenkins-cron.yaml Normal file
View file

@ -0,0 +1,86 @@
kind: ConfigMap
apiVersion: v1
data:
config.yaml: |-
gradle:
caches:
- /home/gradle/caches
jenkins:
schema: https
url: jenkins-ops.shasoapp.com
user: admin ## 需要替换
token: xxxx ## 需要替换
number: lastBuild
default_parameters:
- only_build: true ## jenkins中配置
jobs: # 需要编译的项目列表
- echo-rework
- turing-message-center
- turing-payment-service
- turing-dmp
- turing-faceup
- turing-fluenty
- turing-maxxhealth
---
kind: CronJob
apiVersion: batch/v1
metadata:
name: jenkins-cron
namespace: ops
annotations:
description: 定时清理gradle缓存并刷新
spec:
schedule: 0 3 * * * # 每天3点开始执行
concurrencyPolicy: Replace
suspend: false
jobTemplate:
metadata:
creationTimestamp: null
spec:
template:
metadata:
creationTimestamp: null
labels:
app: jenkins-cron
version: v1
spec:
volumes:
- name: gradle
persistentVolumeClaim:
claimName: pvc-jenkins-m2 ## gradle使用的缓存目录
- name: config
configMap:
name: jenkins-cron-cm
defaultMode: 420
containers:
- name: jenkins-cron
image: swr.cn-east-3.myhuaweicloud.com/turingsyn/ops/jenkins-cron:v1.9
command:
- /app/jenkins-cron
resources: {}
volumeMounts:
- name: gradle
mountPath: /home/gradle
- name: config
mountPath: /app/config.yaml
subPath: config.yaml
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: OnFailure
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
imagePullSecrets:
- name: default-secret ## 镜像仓库认证文件
schedulerName: default-scheduler
dnsConfig:
options:
- name: single-request-reopen
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 1