- Add `haut-gis-org.github.io`, `vue_vue2leaflet`, and `lobe-chat-1` to the list of skipped repositories. - This change ensures that these repositories are not processed by the cron job, helping streamline operations and avoid unnecessary tasks.
104 lines
3.6 KiB
YAML
104 lines
3.6 KiB
YAML
apiVersion: batch/v1
|
|
kind: CronJob
|
|
metadata:
|
|
name: mirror-git-job
|
|
namespace: mirror-git
|
|
spec:
|
|
schedule: "0 2 * * *" # 每天凌晨2点执行
|
|
concurrencyPolicy: Forbid # 不允许并发执行
|
|
successfulJobsHistoryLimit: 1 # 保留3个成功的历史记录
|
|
failedJobsHistoryLimit: 3 # 保留3个失败的历史记录
|
|
jobTemplate:
|
|
spec:
|
|
template:
|
|
spec:
|
|
#nodeSelector:
|
|
# region: "!cn" # 这里使用节点选择标签确保不在中国区节点执行
|
|
affinity:
|
|
nodeAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
nodeSelectorTerms:
|
|
- matchExpressions:
|
|
- key: region
|
|
operator: NotIn
|
|
values:
|
|
- cn
|
|
- key: kubernetes.io/hostname
|
|
operator: NotIn
|
|
values:
|
|
- kuxueyun-us1
|
|
- bwh-us1
|
|
containers:
|
|
- name: mirror-git
|
|
image: alpine:latest
|
|
#image: debian:bookworm
|
|
command:
|
|
- "/bin/sh"
|
|
- "-c"
|
|
- |
|
|
apk add --no-cache git bash curl jq
|
|
#apt-get update && apt-get install -y git bash curl jq
|
|
git clone https://github.com/songtianlun/mirrorGit.git /tmp/mirrorGit
|
|
chmod +x /tmp/mirrorGit/main.sh
|
|
mkdir -p /var/log/mirrorGit
|
|
env
|
|
cd /tmp/mirrorGit && bash main.sh
|
|
#cd /tmp/mirrorGit && ./main.sh
|
|
#cd /tmp/mirrorGit && ./mirror.sh >> /var/log/mirrorGit/mirror.log 2>&1
|
|
env:
|
|
- name: GITHUB_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mirror-git-secrets
|
|
key: github_user
|
|
- name: GITHUB_TOKEN
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mirror-git-secrets
|
|
key: github_token
|
|
- name: GITEA_URL
|
|
value: "https://git.frytea.com"
|
|
- name: GITEA_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mirror-git-secrets
|
|
key: gitea_user
|
|
- name: GITEA_TOKEN
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mirror-git-secrets
|
|
key: gitea_token
|
|
- name: SKIP_REPOS
|
|
value: "archive,AutoApiSecret,backup-openbilibili-go-common,carrot,ChatGLM-6B,dokploy,hub-mirror,songtianlun,songtianlun.github.io,haut-gis-org.github.io,vue_vue2leaflet,lobe-chat-1"
|
|
- name: ENABLE_MAIL
|
|
value: "true"
|
|
- name: SMTP_SERVER
|
|
value: "smtpdm.aliyun.com"
|
|
- name: SMTP_PORT
|
|
value: "465"
|
|
- name: SMTP_USER
|
|
value: "noreply@mail.frytea.com"
|
|
- name: SMTP_PASS
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mirror-git-secrets
|
|
key: smtp_pass
|
|
- name: MAIL_TO
|
|
value: "tianlun.song@foxmail.com"
|
|
- name: MAIL_FROM
|
|
value: "git-mirror"
|
|
- name: ENABLE_FEISHU
|
|
value: "true"
|
|
- name: FEISHU_WEBHOOK_URL
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mirror-git-secrets
|
|
key: feishu_webhook
|
|
# volumeMounts:
|
|
# - name: log-volume
|
|
# mountPath: /var/log/mirrorGit
|
|
# volumes:
|
|
# - name: log-volume
|
|
# emptyDir: {}
|
|
restartPolicy: OnFailure
|