fix: enforce v02 cloud web validation
This commit is contained in:
@@ -969,8 +969,8 @@ async function buildService({ args, repo, commitId, shortCommit, service, buildC
|
||||
}
|
||||
|
||||
if (service.runtimeKind === "cloud-web") {
|
||||
const build = await run(bunExecutable(), ["web/hwlab-cloud-web/scripts/build.ts"]);
|
||||
if (build.code !== 0) {
|
||||
const check = await run(bunExecutable(), ["run", "--cwd", "web/hwlab-cloud-web", "check"]);
|
||||
if (check.code !== 0) {
|
||||
return {
|
||||
...service,
|
||||
image: ref,
|
||||
@@ -982,11 +982,11 @@ async function buildService({ args, repo, commitId, shortCommit, service, buildC
|
||||
blocker: blocker({
|
||||
type: "environment_blocker",
|
||||
scope: service.serviceId,
|
||||
summary: "cloud web dist build failed before BuildKit image build",
|
||||
next: "Run bun run --cwd web/hwlab-cloud-web build, fix the static asset build, then rerun --publish."
|
||||
summary: "cloud web source check failed before BuildKit image build",
|
||||
next: "Run bun run --cwd web/hwlab-cloud-web check, fix TypeScript/unit/build failures, then rerun --publish."
|
||||
}),
|
||||
logTail: tailText(`${build.stdout}\n${build.stderr}`),
|
||||
cloudWebBuildDurationMs: build.durationMs
|
||||
logTail: tailText(`${check.stdout}\n${check.stderr}`),
|
||||
cloudWebCheckDurationMs: check.durationMs
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1013,7 +1013,7 @@ async function buildService({ args, repo, commitId, shortCommit, service, buildC
|
||||
service = {
|
||||
...service,
|
||||
distFreshness,
|
||||
cloudWebBuildDurationMs: build.durationMs
|
||||
cloudWebCheckDurationMs: check.durationMs
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -180,6 +180,13 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
|
||||
assert.doesNotMatch(JSON.stringify(collectArtifacts), /tasks\.build-hwlab-device-pod\.results/u);
|
||||
const devicePodBuildScript = taskByName(pipelineJson, "build-hwlab-device-pod").taskSpec.steps.find((step) => step.name === "publish")?.script ?? "";
|
||||
assert.match(devicePodBuildScript, /--report "\/workspace\/source\/service-results\/\$\(params\.service-id\)\.json"/u);
|
||||
const cloudWebBuildScript = taskByName(pipelineJson, "build-hwlab-cloud-web").taskSpec.steps.find((step) => step.name === "publish")?.script ?? "";
|
||||
assert.match(cloudWebBuildScript, /node scripts\/g14-artifact-publish\.mjs --publish/u);
|
||||
|
||||
const artifactPublishSource = await readFile("scripts/artifact-publish.mjs", "utf8");
|
||||
assert.match(artifactPublishSource, /\["run", "--cwd", "web\/hwlab-cloud-web", "check"\]/u);
|
||||
assert.match(artifactPublishSource, /cloud web source check failed before BuildKit image build/u);
|
||||
assert.doesNotMatch(artifactPublishSource, /Run bun run --cwd web\/hwlab-cloud-web build, fix the static asset build/u);
|
||||
|
||||
const workloads = await readFile(path.join(outDir, "runtime-v02", "workloads.yaml"), "utf8");
|
||||
const workloadsJson = JSON.parse(workloads);
|
||||
|
||||
Reference in New Issue
Block a user