Skip to content

Commit 2f589aa

Browse files
committed
ci: tolerate missing prerelease plan on target refs
1 parent 07104c8 commit 2f589aa

2 files changed

Lines changed: 33 additions & 6 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ jobs:
139139
import {
140140
createNodeTestShards,
141141
} from "./scripts/lib/ci-node-test-plan.mjs";
142-
import {
143-
assertPluginPrereleaseTestPlanComplete,
144-
} from "./scripts/lib/plugin-prerelease-test-plan.mjs";
145142
import {
146143
createChannelContractTestShards,
147144
} from "./scripts/lib/channel-contract-test-plan.mjs";
@@ -184,7 +181,6 @@ jobs:
184181
const runSkillsPython = parseBoolean(process.env.OPENCLAW_CI_RUN_SKILLS_PYTHON) && !docsOnly;
185182
const runControlUiI18n =
186183
parseBoolean(process.env.OPENCLAW_CI_RUN_CONTROL_UI_I18N) && !docsOnly;
187-
const pluginPrereleasePlan = assertPluginPrereleaseTestPlanComplete();
188184
const isMegaCiRun = process.env.OPENCLAW_CI_EVENT_NAME === "workflow_dispatch";
189185
const trustedPluginPrereleaseRef =
190186
process.env.OPENCLAW_CI_EVENT_NAME !== "pull_request" ||
@@ -193,8 +189,33 @@ jobs:
193189
process.env.OPENCLAW_CI_EVENT_NAME === "pull_request" && trustedPluginPrereleaseRef
194190
? process.env.OPENCLAW_CI_PR_HEAD_SHA
195191
: process.env.OPENCLAW_CI_CHECKOUT_REVISION;
196-
const runPluginPrereleaseSuite =
192+
let runPluginPrereleaseSuite =
197193
isMegaCiRun && runNodeFull && isCanonicalRepository;
194+
let pluginPrereleasePlan = { staticChecks: [], dockerLanes: [] };
195+
if (runPluginPrereleaseSuite) {
196+
try {
197+
const { assertPluginPrereleaseTestPlanComplete } = await import(
198+
"./scripts/lib/plugin-prerelease-test-plan.mjs"
199+
);
200+
pluginPrereleasePlan = assertPluginPrereleaseTestPlanComplete();
201+
} catch (error) {
202+
const errorCode =
203+
error && typeof error === "object" && "code" in error ? error.code : "";
204+
const moduleUrl =
205+
error && typeof error === "object" && "url" in error ? String(error.url) : "";
206+
if (
207+
errorCode === "ERR_MODULE_NOT_FOUND" &&
208+
moduleUrl.endsWith("/scripts/lib/plugin-prerelease-test-plan.mjs")
209+
) {
210+
console.warn(
211+
"Plugin prerelease plan unavailable in target ref; skipping plugin prerelease suite.",
212+
);
213+
runPluginPrereleaseSuite = false;
214+
} else {
215+
throw error;
216+
}
217+
}
218+
}
198219
const extensionTestShardCount = isCanonicalRepository
199220
? DEFAULT_EXTENSION_TEST_SHARD_COUNT
200221
: Math.max(DEFAULT_EXTENSION_TEST_SHARD_COUNT, 36);

‎test/scripts/plugin-prerelease-test-plan.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,13 @@ describe("scripts/lib/plugin-prerelease-test-plan.mjs", () => {
127127
'const isMegaCiRun = process.env.OPENCLAW_CI_EVENT_NAME === "workflow_dispatch";',
128128
);
129129
expect(manifestScript).toContain(
130-
"const runPluginPrereleaseSuite =\n isMegaCiRun && runNodeFull && isCanonicalRepository;",
130+
"let runPluginPrereleaseSuite =\n isMegaCiRun && runNodeFull && isCanonicalRepository;",
131+
);
132+
expect(manifestScript).toContain("await import(");
133+
expect(manifestScript).toContain('"./scripts/lib/plugin-prerelease-test-plan.mjs"');
134+
expect(manifestScript).not.toContain('} from "./scripts/lib/plugin-prerelease-test-plan.mjs";');
135+
expect(manifestScript).toContain(
136+
"Plugin prerelease plan unavailable in target ref; skipping plugin prerelease suite.",
131137
);
132138
expect(staticShard.strategy.matrix).toBe(
133139
"${{ fromJson(needs.preflight.outputs.plugin_prerelease_static_matrix) }}",

0 commit comments

Comments
 (0)