Skip to content

Commit 27ceb13

Browse files
authored
fix(ci): select trusted release harness for Docker lanes (#103504)
1 parent c6ddb4b commit 27ceb13

2 files changed

Lines changed: 62 additions & 4 deletions

File tree

scripts/lib/docker-e2e-scenarios.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { fileURLToPath } from "node:url";
55

66
export const DEFAULT_LIVE_RETRIES = 1;
77
const LIVE_DOCKER_DEFAULT_HARNESS_DIR =
8-
/[\\/]\\.release-harness[\\/]/u.test(fileURLToPath(import.meta.url)) &&
8+
/[\\/]\.release-harness[\\/]/u.test(fileURLToPath(import.meta.url)) &&
99
process.env.OPENCLAW_DOCKER_E2E_REPO_ROOT
1010
? ".release-harness"
1111
: ".";

test/scripts/docker-e2e-plan.test.ts

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
// Docker E2E Plan tests cover docker e2e plan script behavior.
2-
import { readFileSync } from "node:fs";
3-
import { describe, expect, it } from "vitest";
2+
import { execFileSync } from "node:child_process";
3+
import { copyFileSync, mkdirSync, readFileSync } from "node:fs";
4+
import { dirname, join } from "node:path";
5+
import { afterEach, describe, expect, it } from "vitest";
6+
import { useAutoCleanupTempDirTracker } from "../helpers/temp-dir.js";
47
import {
58
DEFAULT_LIVE_RETRIES,
69
RELEASE_PATH_PROFILE,
710
parseLaneSelection,
811
resolveDockerE2ePlan,
912
} from "../../scripts/lib/docker-e2e-plan.mjs";
10-
import { BUNDLED_PLUGIN_INSTALL_UNINSTALL_SHARDS } from "../../scripts/lib/docker-e2e-scenarios.mjs";
13+
import {
14+
allReleasePathLanes,
15+
BUNDLED_PLUGIN_INSTALL_UNINSTALL_SHARDS,
16+
} from "../../scripts/lib/docker-e2e-scenarios.mjs";
1117

18+
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
1219
const orderLanes = <T>(lanes: T[]) => lanes;
1320
const packageJson = JSON.parse(readFileSync("package.json", "utf8")) as {
1421
scripts?: Record<string, string>;
@@ -97,6 +104,57 @@ function bundledPluginSweepLane(index: number): ReturnType<typeof summarizeLane>
97104
}
98105

99106
describe("scripts/lib/docker-e2e-plan", () => {
107+
it("routes live Docker scripts through the nested trusted release harness", () => {
108+
const sourceLane = allReleasePathLanes({ releaseProfile: "beta" }).find(
109+
(candidate) => candidate.name === "live-codex-npm-plugin",
110+
);
111+
const tempRoot = tempDirs.make("openclaw-release-harness-");
112+
const nestedModule = join(
113+
tempRoot,
114+
".release-harness",
115+
"scripts",
116+
"lib",
117+
"docker-e2e-scenarios.mjs",
118+
);
119+
120+
expect(sourceLane?.command).toContain(
121+
'harness="${OPENCLAW_DOCKER_E2E_TRUSTED_HARNESS_DIR:-.}"',
122+
);
123+
124+
mkdirSync(dirname(nestedModule), { recursive: true });
125+
copyFileSync("scripts/lib/docker-e2e-scenarios.mjs", nestedModule);
126+
127+
const laneJson = execFileSync(
128+
process.execPath,
129+
[
130+
"--input-type=module",
131+
"--eval",
132+
`
133+
import { pathToFileURL } from "node:url";
134+
const scenarios = await import(pathToFileURL(process.argv[1]).href);
135+
const lane = scenarios
136+
.allReleasePathLanes({ releaseProfile: "beta" })
137+
.find((candidate) => candidate.name === "live-codex-npm-plugin");
138+
process.stdout.write(JSON.stringify(lane));
139+
`,
140+
nestedModule,
141+
],
142+
{
143+
encoding: "utf8",
144+
env: {
145+
...process.env,
146+
OPENCLAW_DOCKER_E2E_REPO_ROOT: tempRoot,
147+
},
148+
},
149+
);
150+
const lane = JSON.parse(laneJson) as { command: string };
151+
152+
expect(lane.command).toContain(
153+
'harness="${OPENCLAW_DOCKER_E2E_TRUSTED_HARNESS_DIR:-.release-harness}"',
154+
);
155+
expect(lane.command).toContain('bash "$harness/scripts/e2e/codex-npm-plugin-live-docker.sh"');
156+
});
157+
100158
it("plans package-backed Compose and package artifact proofs", () => {
101159
const plan = planFor({
102160
selectedLaneNames: ["compose-setup", "docker-package-install"],

0 commit comments

Comments
 (0)