fix: use full CICD render cache
This commit is contained in:
@@ -18,10 +18,13 @@ test("CI/CD repo cache is materialized for local shared render clones", () => {
|
||||
} as never);
|
||||
|
||||
assert.doesNotMatch(script, /--filter=blob:none/u);
|
||||
assert.doesNotMatch(script, /--depth=1/u);
|
||||
assert.match(script, /reason=partial-clone-cache/u);
|
||||
assert.match(script, /reason=shallow-clone-cache/u);
|
||||
assert.match(script, /\[ -f "\$cicd_repo\/shallow" \]/u);
|
||||
assert.match(script, /reason=missing-fetched-tree-object/u);
|
||||
assert.match(script, /cat-file -e "refs\/remotes\/origin\/\$cicd_branch\^\{tree\}"/u);
|
||||
assert.match(script, /remote\.origin\.promisor/u);
|
||||
assert.match(script, /remote\.origin\.partialclonefilter/u);
|
||||
assert.match(script, /clone --bare --depth=1 --single-branch/u);
|
||||
assert.match(script, /clone --bare --single-branch/u);
|
||||
});
|
||||
|
||||
@@ -202,8 +202,10 @@ export function runtimeLaneCicdRepoEnsureScript(spec: HwlabRuntimeLaneSpec): str
|
||||
"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",
|
||||
" if [ \"$cicd_promisor\" = \"true\" ] || [ -n \"$cicd_promisor_pack\" ] || [ -f \"$cicd_repo/shallow\" ]; then",
|
||||
" reason=partial-clone-cache",
|
||||
" if [ -f \"$cicd_repo/shallow\" ]; then reason=shallow-clone-cache; fi",
|
||||
" echo \"phase=git-ci-cache-rebuild reason=$reason\" >&2",
|
||||
" rm -rf \"$cicd_repo\"",
|
||||
" fi",
|
||||
"fi",
|
||||
@@ -213,28 +215,28 @@ export function runtimeLaneCicdRepoEnsureScript(spec: HwlabRuntimeLaneSpec): str
|
||||
" 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 --depth=1 --single-branch --branch \"$cicd_branch\" \"$cicd_url\" \"$cicd_repo\"",
|
||||
" retry_git clone-ci-cache clone --bare --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/*'",
|
||||
"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",
|
||||
"if ! retry_git fetch-ci-cache --git-dir=\"$cicd_repo\" fetch origin \"+refs/heads/$cicd_branch:refs/remotes/origin/$cicd_branch\" --prune; then",
|
||||
" rm -rf \"$cicd_repo\"",
|
||||
" retry_git clone-ci-cache-retry clone --bare --depth=1 --single-branch --branch \"$cicd_branch\" \"$cicd_url\" \"$cicd_repo\"",
|
||||
" retry_git clone-ci-cache-retry clone --bare --single-branch --branch \"$cicd_branch\" \"$cicd_url\" \"$cicd_repo\"",
|
||||
" git --git-dir=\"$cicd_repo\" config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'",
|
||||
" 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",
|
||||
" retry_git fetch-ci-cache-retry --git-dir=\"$cicd_repo\" fetch origin \"+refs/heads/$cicd_branch:refs/remotes/origin/$cicd_branch\" --prune",
|
||||
"fi",
|
||||
"if ! git --git-dir=\"$cicd_repo\" cat-file -e \"refs/remotes/origin/$cicd_branch^{tree}\" 2>/dev/null; then",
|
||||
" echo \"phase=git-ci-cache-rebuild reason=missing-fetched-tree-object\" >&2",
|
||||
" rm -rf \"$cicd_repo\"",
|
||||
" retry_git clone-ci-cache-object-retry clone --bare --depth=1 --single-branch --branch \"$cicd_branch\" \"$cicd_url\" \"$cicd_repo\"",
|
||||
" retry_git clone-ci-cache-object-retry clone --bare --single-branch --branch \"$cicd_branch\" \"$cicd_url\" \"$cicd_repo\"",
|
||||
" git --git-dir=\"$cicd_repo\" config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'",
|
||||
" 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-object-retry --git-dir=\"$cicd_repo\" fetch --depth=1 origin \"+refs/heads/$cicd_branch:refs/remotes/origin/$cicd_branch\" --prune",
|
||||
" retry_git fetch-ci-cache-object-retry --git-dir=\"$cicd_repo\" fetch origin \"+refs/heads/$cicd_branch:refs/remotes/origin/$cicd_branch\" --prune",
|
||||
" git --git-dir=\"$cicd_repo\" cat-file -e \"refs/remotes/origin/$cicd_branch^{tree}\"",
|
||||
"fi",
|
||||
].join("\n");
|
||||
|
||||
Reference in New Issue
Block a user