mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-03 23:14:03 +00:00
fix(ci): bootstrap raw changed gates from clean checkouts
This commit is contained in:
@@ -1880,15 +1880,18 @@ function isWorktreeClean() {
|
||||
return gitOutput(["status", "--porcelain=v1"]).stdout === "";
|
||||
}
|
||||
|
||||
function shouldUseFullCheckoutForCleanSparseRemoteSync(commandArgs, _providerName) {
|
||||
function shouldUseFullCheckoutForCleanRemoteSync(commandArgs, _providerName) {
|
||||
if (commandArgs[0] !== "run") {
|
||||
return false;
|
||||
}
|
||||
if (hasOption(commandArgs, "--no-sync")) {
|
||||
return false;
|
||||
}
|
||||
if (!isWorktreeClean()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isSparseCheckout() && isWorktreeClean();
|
||||
return isSparseCheckout() || isChangedGateCommand(runCommandArgs(commandArgs));
|
||||
}
|
||||
|
||||
function prepareFullCheckoutForSync(options = {}) {
|
||||
@@ -2099,7 +2102,7 @@ const scriptBootstrap = prepareAwsMacosScriptStdinBootstrap(normalizedArgs, prov
|
||||
normalizedArgs = scriptBootstrap.args;
|
||||
const scriptStdinPrepared = scriptBootstrap.prepared;
|
||||
try {
|
||||
if (shouldUseFullCheckoutForCleanSparseRemoteSync(normalizedArgs, provider)) {
|
||||
if (shouldUseFullCheckoutForCleanRemoteSync(normalizedArgs, provider)) {
|
||||
const runWords = runCommandArgs(normalizedArgs);
|
||||
const changedGateBase = isChangedGateCommand(runWords) ? mergeBaseForChangedGate() : "";
|
||||
const checkout = prepareFullCheckoutForSync({ changedGateBase });
|
||||
|
||||
@@ -1816,6 +1816,34 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("bootstraps Git metadata for non-sparse changed gates on remote raw syncs", () => {
|
||||
const result = runWrapper(
|
||||
"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
|
||||
["run", "--provider", "aws", "--", "corepack", "pnpm", "check:changed"],
|
||||
{
|
||||
gitResponses: {
|
||||
[GIT_STATUS_PORCELAIN_KEY]: { stdout: "" },
|
||||
[GIT_MERGE_BASE_MAIN_HEAD_KEY]: { stdout: "abc123\n" },
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const output = parseFakeCrabboxOutput(result);
|
||||
const remoteCommand = normalizeShellLineEndings(output.args.at(-1) ?? "");
|
||||
expect(result.status).toBe(0);
|
||||
expect(result.stderr).toContain("syncing from temporary full checkout");
|
||||
expect(result.stderr).toContain("overlaying local HEAD as worktree changes from abc123");
|
||||
expect(output.cwd).toContain("openclaw-crabbox-sync-");
|
||||
expect(output.args).toContain("--shell");
|
||||
expect(remoteCommand).toContain("git init -q");
|
||||
expect(remoteCommand).toContain(
|
||||
"git fetch -q --depth=1 origin abc123:refs/remotes/origin/main",
|
||||
);
|
||||
expect(remoteCommand).toMatch(
|
||||
/&& env OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 CI=1 corepack pnpm check:changed$/u,
|
||||
);
|
||||
});
|
||||
|
||||
it("bootstraps Git metadata for env-prefixed sparse changed gates", () => {
|
||||
const result = runWrapper(
|
||||
"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
|
||||
|
||||
Reference in New Issue
Block a user