fix: use clean v02 render worktree
This commit is contained in:
@@ -1168,24 +1168,38 @@ function runControlPlaneCleanup(options: G14ControlPlaneOptions): Record<string,
|
||||
};
|
||||
}
|
||||
|
||||
function runV02RenderToTemp(sourceCommit: string): CommandJsonResult {
|
||||
export function v02ControlPlaneRenderScript(sourceCommit: string): string {
|
||||
const renderDir = v02RenderDir(sourceCommit);
|
||||
return v02WorkspaceScript([
|
||||
const worktreeDir = v02RenderWorktreeDir(sourceCommit);
|
||||
return [
|
||||
"set -eu",
|
||||
`render_dir=${shellQuote(renderDir)}`,
|
||||
`worktree_dir=${shellQuote(worktreeDir)}`,
|
||||
"cleanup_render_worktree() { git worktree remove --force \"$worktree_dir\" >/dev/null 2>&1 || rm -rf \"$worktree_dir\"; }",
|
||||
"trap cleanup_render_worktree EXIT",
|
||||
"git fetch origin v0.2 --prune",
|
||||
"git checkout v0.2 >/dev/null 2>&1 || true",
|
||||
"git merge --ff-only origin/v0.2",
|
||||
`test "$(git rev-parse HEAD)" = ${shellQuote(sourceCommit)}`,
|
||||
`rm -rf ${shellQuote(renderDir)}`,
|
||||
`mkdir -p ${shellQuote(renderDir)}`,
|
||||
`node scripts/g14-gitops-render.mjs --lane v02 --source-revision ${shellQuote(sourceCommit)} --out ${shellQuote(renderDir)}`,
|
||||
].join("\n"), 180_000);
|
||||
`test "$(git rev-parse origin/v0.2)" = ${shellQuote(sourceCommit)}`,
|
||||
"cleanup_render_worktree",
|
||||
"rm -rf \"$render_dir\"",
|
||||
"mkdir -p \"$render_dir\" \"$(dirname \"$worktree_dir\")\"",
|
||||
`git worktree add --detach "$worktree_dir" ${shellQuote(sourceCommit)}`,
|
||||
"cd \"$worktree_dir\"",
|
||||
`node scripts/g14-gitops-render.mjs --lane v02 --source-revision ${shellQuote(sourceCommit)} --out "$render_dir"`,
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
function runV02RenderToTemp(sourceCommit: string): CommandJsonResult {
|
||||
return v02WorkspaceScript(v02ControlPlaneRenderScript(sourceCommit), 180_000);
|
||||
}
|
||||
|
||||
function v02RenderDir(sourceCommit: string): string {
|
||||
return `/tmp/hwlab-v02-control-plane-${shortSha(sourceCommit)}`;
|
||||
}
|
||||
|
||||
function v02RenderWorktreeDir(sourceCommit: string): string {
|
||||
return `/tmp/hwlab-v02-control-plane-source-${shortSha(sourceCommit)}`;
|
||||
}
|
||||
|
||||
function applyV02ControlPlaneFiles(sourceCommit: string, dryRun: boolean, timeoutSeconds: number): CommandJsonResult {
|
||||
const renderDir = v02RenderDir(sourceCommit);
|
||||
return g14K3s([
|
||||
|
||||
Reference in New Issue
Block a user