fix: materialize node CICD cache
This commit is contained in:
@@ -200,20 +200,32 @@ export function runtimeLaneCicdRepoEnsureScript(spec: HwlabRuntimeLaneSpec): str
|
||||
"}",
|
||||
"mkdir -p \"$(dirname \"$cicd_repo\")\"",
|
||||
"if [ -d \"$cicd_repo/objects\" ] && [ -f \"$cicd_repo/HEAD\" ]; then",
|
||||
" cicd_promisor=$(git --git-dir=\"$cicd_repo\" config --bool remote.origin.promisor 2>/dev/null || true)",
|
||||
" cicd_promisor_pack=$(find \"$cicd_repo/objects/pack\" -maxdepth 1 -name '*.promisor' -print -quit 2>/dev/null || true)",
|
||||
" if [ \"$cicd_promisor\" = \"true\" ] || [ -n \"$cicd_promisor_pack\" ]; then",
|
||||
" echo \"phase=git-ci-cache-rebuild reason=partial-clone-cache\" >&2",
|
||||
" rm -rf \"$cicd_repo\"",
|
||||
" fi",
|
||||
"fi",
|
||||
"if [ -d \"$cicd_repo/objects\" ] && [ -f \"$cicd_repo/HEAD\" ]; then",
|
||||
" :",
|
||||
"elif [ -e \"$cicd_repo\" ]; then",
|
||||
" echo \"CI/CD repo path exists but is not a bare git repo: $cicd_repo\" >&2",
|
||||
" exit 41",
|
||||
"else",
|
||||
" retry_git clone-ci-cache clone --bare --filter=blob:none --single-branch --branch \"$cicd_branch\" \"$cicd_url\" \"$cicd_repo\"",
|
||||
" retry_git clone-ci-cache clone --bare --depth=1 --single-branch --branch \"$cicd_branch\" \"$cicd_url\" \"$cicd_repo\"",
|
||||
"fi",
|
||||
"git --git-dir=\"$cicd_repo\" remote set-url origin \"$cicd_url\" 2>/dev/null || git --git-dir=\"$cicd_repo\" remote add origin \"$cicd_url\"",
|
||||
"git --git-dir=\"$cicd_repo\" config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'",
|
||||
"if ! retry_git fetch-ci-cache --git-dir=\"$cicd_repo\" fetch --filter=blob:none --depth=1 origin \"+refs/heads/$cicd_branch:refs/remotes/origin/$cicd_branch\" --prune; then",
|
||||
"git --git-dir=\"$cicd_repo\" config --unset-all remote.origin.promisor 2>/dev/null || true",
|
||||
"git --git-dir=\"$cicd_repo\" config --unset-all remote.origin.partialclonefilter 2>/dev/null || true",
|
||||
"if ! retry_git fetch-ci-cache --git-dir=\"$cicd_repo\" fetch --depth=1 origin \"+refs/heads/$cicd_branch:refs/remotes/origin/$cicd_branch\" --prune; then",
|
||||
" rm -rf \"$cicd_repo\"",
|
||||
" retry_git clone-ci-cache-retry clone --bare --filter=blob:none --single-branch --branch \"$cicd_branch\" \"$cicd_url\" \"$cicd_repo\"",
|
||||
" retry_git clone-ci-cache-retry clone --bare --depth=1 --single-branch --branch \"$cicd_branch\" \"$cicd_url\" \"$cicd_repo\"",
|
||||
" git --git-dir=\"$cicd_repo\" config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'",
|
||||
" retry_git fetch-ci-cache-retry --git-dir=\"$cicd_repo\" fetch --filter=blob:none --depth=1 origin \"+refs/heads/$cicd_branch:refs/remotes/origin/$cicd_branch\" --prune",
|
||||
" git --git-dir=\"$cicd_repo\" config --unset-all remote.origin.promisor 2>/dev/null || true",
|
||||
" git --git-dir=\"$cicd_repo\" config --unset-all remote.origin.partialclonefilter 2>/dev/null || true",
|
||||
" retry_git fetch-ci-cache-retry --git-dir=\"$cicd_repo\" fetch --depth=1 origin \"+refs/heads/$cicd_branch:refs/remotes/origin/$cicd_branch\" --prune",
|
||||
"fi",
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user