mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-14 10:29:52 +08:00
🐛 fix(ci): 修复工作流改动漏触发驱动重建
This commit is contained in:
@@ -21,6 +21,8 @@ usage() {
|
||||
说明:
|
||||
通过 go list -deps 计算每个 driver-agent 的真实源码依赖,再与 git diff 文件求交集。
|
||||
如果无法解析基准或依赖分析失败,会保守输出全部 driver。
|
||||
如果 driver 构建 / 发布工作流本身发生变化,也会保守输出全部 driver,
|
||||
避免新应用 revision 与旧 driver-assets 再次错配。
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -517,6 +519,11 @@ for file in "${!changed_file_set[@]}"; do
|
||||
all_drivers_csv
|
||||
exit 0
|
||||
;;
|
||||
.github/workflows/dev-build.yml|.github/workflows/release.yml)
|
||||
echo "检测到 driver-agent 构建/发布工作流变更;保守构建全部 driver-agent:$file" >&2
|
||||
all_drivers_csv
|
||||
exit 0
|
||||
;;
|
||||
tools/detect-changed-driver-agents.sh)
|
||||
echo "检测到 driver-agent 变更检测脚本更新;保守构建全部 driver-agent:$file" >&2
|
||||
all_drivers_csv
|
||||
|
||||
@@ -114,4 +114,29 @@ YAMLEOF
|
||||
fi
|
||||
)
|
||||
|
||||
tmpdir_workflow="$(mktemp -d "${TMPDIR:-/tmp}/gonavi-detect-workflow-change.XXXXXX")"
|
||||
git init -q "$tmpdir_workflow"
|
||||
mkdir -p "$tmpdir_workflow/tools" "$tmpdir_workflow/.github/workflows"
|
||||
cp tools/detect-changed-driver-agents.sh "$tmpdir_workflow/tools/detect-changed-driver-agents.sh"
|
||||
cat >"$tmpdir_workflow/.github/workflows/dev-build.yml" <<'YAMLEOF'
|
||||
name: Dev Build
|
||||
YAMLEOF
|
||||
|
||||
(
|
||||
cd "$tmpdir_workflow"
|
||||
git add .
|
||||
git -c user.name=GoNavi -c user.email=gonavi@example.test commit -q -m initial
|
||||
base="$(git rev-parse HEAD)"
|
||||
|
||||
printf '\n# workflow logic changed\n' >> .github/workflows/dev-build.yml
|
||||
git add .github/workflows/dev-build.yml
|
||||
git -c user.name=GoNavi -c user.email=gonavi@example.test commit -q -m 'update workflow'
|
||||
|
||||
actual="$(bash ./tools/detect-changed-driver-agents.sh --base "$base" --head HEAD 2>/dev/null)"
|
||||
if [[ "$actual" != *"mariadb"* || "$actual" != *"clickhouse"* || "$actual" != *"duckdb"* || "$actual" != *"elasticsearch"* ]]; then
|
||||
echo "expected workflow change to trigger all driver builds, got: ${actual:-<empty>}" >&2
|
||||
exit 1
|
||||
fi
|
||||
)
|
||||
|
||||
echo "detect-changed-driver-agents revision test passed"
|
||||
|
||||
Reference in New Issue
Block a user