56 lines
2.0 KiB
YAML
56 lines
2.0 KiB
YAML
# Jenkins Job 配置说明
|
||
# 本文件描述如何在 Jenkins 中创建对应的 Pipeline Job
|
||
# 详细步骤见 docs/jenkins-cd/01-local-dev-setup.md
|
||
|
||
# ── 轮询模式 Job(本地开发)────────────────────────────────
|
||
poll_job:
|
||
name: "juwan-backend-cd-poll"
|
||
type: Pipeline
|
||
pipeline_script_from_scm: true
|
||
scm:
|
||
type: Git
|
||
# 填写你的 Gitea 仓库地址
|
||
url: "http://103.236.53.208:3000/YOUR_ORG/juwan-backend.git"
|
||
branch: "*/main"
|
||
credentials_id: "gitea-credentials"
|
||
script_path: "deploy/jenkins/Jenkinsfile.poll"
|
||
# 不勾选 SCM 轮询(触发器在 Jenkinsfile 内用 cron 定义)
|
||
build_triggers:
|
||
poll_scm: false
|
||
|
||
# ── Webhook 模式 Job(生产环境)──────────────────────────────
|
||
webhook_job:
|
||
name: "juwan-backend-cd-webhook"
|
||
type: Pipeline
|
||
pipeline_script_from_scm: true
|
||
scm:
|
||
type: Git
|
||
url: "https://YOUR_PROD_GIT_REPO/juwan-backend.git"
|
||
branch: "*/main"
|
||
credentials_id: "gitea-credentials-prod"
|
||
script_path: "deploy/jenkins/Jenkinsfile.webhook"
|
||
build_triggers:
|
||
generic_webhook_trigger: true
|
||
# token 与 Jenkinsfile.webhook 中的 token 字段一致
|
||
token: "JUWAN_CD_TOKEN"
|
||
|
||
# ── 所需 Jenkins 凭据 ─────────────────────────────────────
|
||
credentials:
|
||
- id: "harbor-credentials"
|
||
type: "Username with password"
|
||
description: "Harbor 镜像仓库登录凭据"
|
||
# 在 Jenkins → Manage Credentials 中创建
|
||
|
||
- id: "kubeconfig-dev"
|
||
type: "Secret file"
|
||
description: "k3s 开发集群 kubeconfig 文件"
|
||
# 文件内容:cat ~/.kube/config(或 /etc/rancher/k3s/k3s.yaml)
|
||
|
||
- id: "kubeconfig-prod"
|
||
type: "Secret file"
|
||
description: "生产 Kubernetes 集群 kubeconfig 文件"
|
||
|
||
- id: "gitea-credentials"
|
||
type: "Username with password"
|
||
description: "Gitea 仓库访问凭据(用于 SCM checkout)"
|