This commit is contained in:
parent
c04878423b
commit
9d38e2ae26
@ -1,5 +1,5 @@
|
|||||||
# push 到 main/master → 渲染密钥 → 写入 Consul → 重启相关 API
|
# push 到 main/master → 渲染密钥 → 写入 Consul → 重启相关 API
|
||||||
# runner: k3s-host(与 api 部署同一台,可访问 ClusterIP + kubectl)
|
# 触发方式与 api/front 一致(不做 paths 过滤,避免「推了却不跑」)
|
||||||
name: Sync Consul Config
|
name: Sync Consul Config
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@ -10,15 +10,6 @@ on:
|
|||||||
- "scripts/**"
|
- "scripts/**"
|
||||||
- ".gitea/workflows/sync-consul.yml"
|
- ".gitea/workflows/sync-consul.yml"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
|
||||||
targets:
|
|
||||||
description: "同步目标(空=全部;或 admin / common / itfxapi / trackapi,空格分隔)"
|
|
||||||
required: false
|
|
||||||
default: ""
|
|
||||||
restart:
|
|
||||||
description: "同步后重启 API(1/0)"
|
|
||||||
required: false
|
|
||||||
default: "1"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync:
|
sync:
|
||||||
@ -29,10 +20,6 @@ jobs:
|
|||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
|
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
|
||||||
export NAMESPACE=prod
|
export NAMESPACE=prod
|
||||||
export RESTART_APIS="${{ gitea.event.inputs.restart || '1' }}"
|
|
||||||
if [[ "${{ gitea.event_name }}" == "push" ]]; then
|
|
||||||
export RESTART_APIS=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
REPO="${{ gitea.repository }}"
|
REPO="${{ gitea.repository }}"
|
||||||
REPO="${REPO:-${{ github.repository }}}"
|
REPO="${REPO:-${{ github.repository }}}"
|
||||||
@ -58,10 +45,4 @@ jobs:
|
|||||||
git checkout --force --quiet FETCH_HEAD
|
git checkout --force --quiet FETCH_HEAD
|
||||||
|
|
||||||
chmod +x scripts/sync-to-consul.sh
|
chmod +x scripts/sync-to-consul.sh
|
||||||
TARGETS="${{ gitea.event.inputs.targets }}"
|
|
||||||
if [[ -n "${TARGETS// /}" ]]; then
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
./scripts/sync-to-consul.sh $TARGETS
|
|
||||||
else
|
|
||||||
./scripts/sync-to-consul.sh
|
./scripts/sync-to-consul.sh
|
||||||
fi
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user