Skip to content

Commit 5d3bd15

Browse files
authored
fix(release): preserve plugin validation for frozen targets (#132326)
* fix(release): support frozen plugin test planners * fix(release): carry frozen plugin test dependencies * fix(release): pin frozen plugin security inventory * fix(release): repair frozen plugin CI checks
1 parent 5e135e3 commit 5d3bd15

6 files changed

Lines changed: 355 additions & 88 deletions

File tree

‎.github/workflows/plugin-prerelease.yml‎

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -270,24 +270,29 @@ jobs:
270270
}
271271
272272
try {
273-
const {
274-
createExtensionTestShards,
275-
DEFAULT_EXTENSION_TEST_SHARD_COUNT,
276-
splitExtensionTestJobTargets,
277-
} = await import(targetPlanPath("extension-test-plan"));
278-
const allExtensionShards = createExtensionTestShards({
279-
shardCount: DEFAULT_EXTENSION_TEST_SHARD_COUNT,
273+
const planner = await import(targetPlanPath("extension-test-plan"));
274+
const allExtensionShards = planner.createExtensionTestShards({
275+
shardCount: planner.DEFAULT_EXTENSION_TEST_SHARD_COUNT,
280276
});
281-
const telegramPlanGroup = allExtensionShards
282-
.find((shard) => shard.extensionIds.includes("telegram"))
283-
?.planGroups.find((group) => group.extensionIds.includes("telegram"));
284-
const genericExtensionIds = allExtensionShards
285-
.flatMap((shard) => shard.extensionIds)
286-
.filter((extensionId) => extensionId !== "telegram");
287-
const batchShards = createExtensionTestShards({
288-
extensionIds: genericExtensionIds,
289-
shardCount: DEFAULT_EXTENSION_TEST_SHARD_COUNT,
290-
}).map((shard) => ({
277+
const hasJobSplitter = typeof planner.splitExtensionTestJobTargets === "function";
278+
const telegramPlanGroup = hasJobSplitter
279+
? allExtensionShards
280+
.find((shard) => shard.extensionIds.includes("telegram"))
281+
?.planGroups.find((group) => group.extensionIds.includes("telegram"))
282+
: null;
283+
const genericExtensionIds = hasJobSplitter
284+
? allExtensionShards
285+
.flatMap((shard) => shard.extensionIds)
286+
.filter((extensionId) => extensionId !== "telegram")
287+
: [];
288+
const batchShards = (
289+
hasJobSplitter
290+
? planner.createExtensionTestShards({
291+
extensionIds: genericExtensionIds,
292+
shardCount: planner.DEFAULT_EXTENSION_TEST_SHARD_COUNT,
293+
})
294+
: allExtensionShards
295+
).map((shard) => ({
291296
check_name: shard.checkName,
292297
extensions_csv: shard.extensionIds.join(","),
293298
vitest_config: "",
@@ -314,18 +319,20 @@ jobs:
314319
? path.relative(telegramTestDir, pattern).replaceAll("\\", "/")
315320
: pattern,
316321
);
317-
const telegramTestFiles = globSync(telegramTestConfig.include ?? [], {
318-
cwd: telegramTestDir,
319-
exclude: telegramTestExclude,
320-
})
321-
.map((file) =>
322-
path
323-
.relative(process.cwd(), path.resolve(telegramTestDir, file))
324-
.replaceAll("\\", "/"),
325-
)
326-
.sort();
322+
const telegramTestFiles = telegramPlanGroup
323+
? globSync(telegramTestConfig.include ?? [], {
324+
cwd: telegramTestDir,
325+
exclude: telegramTestExclude,
326+
})
327+
.map((file) =>
328+
path
329+
.relative(process.cwd(), path.resolve(telegramTestDir, file))
330+
.replaceAll("\\", "/"),
331+
)
332+
.sort()
333+
: [];
327334
const telegramJobTargets = telegramPlanGroup
328-
? splitExtensionTestJobTargets(telegramPlanGroup.config, telegramTestFiles)
335+
? planner.splitExtensionTestJobTargets(telegramPlanGroup.config, telegramTestFiles)
329336
: [];
330337
const telegramShards = telegramPlanGroup
331338
? telegramJobTargets.map((includePatterns, index) => ({
@@ -335,7 +342,7 @@ jobs:
335342
vitest_config: telegramPlanGroup.config,
336343
vitest_max_workers: 1,
337344
runner: "blacksmith-8vcpu-ubuntu-2404",
338-
shard_index: DEFAULT_EXTENSION_TEST_SHARD_COUNT + index + 1,
345+
shard_index: planner.DEFAULT_EXTENSION_TEST_SHARD_COUNT + index + 1,
339346
task: "extension-file-shard",
340347
}))
341348
: [];
@@ -496,7 +503,9 @@ jobs:
496503
fetch-depth: 1
497504
fetch-tags: false
498505
persist-credentials: false
499-
sparse-checkout: src/plugins/npm-install-security-scan.release.test.ts
506+
sparse-checkout: |
507+
src/plugins/npm-install-security-scan.release.test.ts
508+
scripts/lib/npm-json-output.mts
500509
sparse-checkout-cone-mode: false
501510
submodules: false
502511

@@ -510,6 +519,9 @@ jobs:
510519
install -m 0644 \
511520
"$trusted_checkout/src/plugins/npm-install-security-scan.release.test.ts" \
512521
src/plugins/npm-install-security-scan.release.test.ts
522+
install -m 0644 \
523+
"$trusted_checkout/scripts/lib/npm-json-output.mts" \
524+
scripts/lib/npm-json-output.mts
513525
rm -rf -- "$trusted_checkout"
514526
trap - EXIT
515527

0 commit comments

Comments
 (0)