Remove repo reports and add recurrence guard
This commit is contained in:
@@ -11,9 +11,10 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
|
||||
import { activeReportLifecycle } from "../internal/dev-report-lifecycle.mjs";
|
||||
import { DEV_ENDPOINT, DEV_FRONTEND_ENDPOINT, ENVIRONMENT_DEV } from "../internal/protocol/index.mjs";
|
||||
import { ensureNotRepoReportsPath, tempReportPath } from "./src/report-paths.mjs";
|
||||
|
||||
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const defaultReportPath = "reports/dev-gate/dev-m3-hardware-loop.json";
|
||||
const defaultReportPath = tempReportPath("dev-m3-hardware-loop.json");
|
||||
const namespace = "hwlab-dev";
|
||||
const issue = "pikasTech/HWLAB#38";
|
||||
const deployWorkloadsPath = "deploy/k8s/base/workloads.yaml";
|
||||
@@ -203,9 +204,7 @@ function relativePath(absolutePath) {
|
||||
}
|
||||
|
||||
function resolveReportPath(value) {
|
||||
const candidate = path.resolve(repoRoot, value ?? defaultReportPath);
|
||||
assert.ok(candidate.startsWith(`${repoRoot}${path.sep}`), "report path must stay inside repository");
|
||||
return candidate;
|
||||
return ensureNotRepoReportsPath(repoRoot, value ?? defaultReportPath, "report path");
|
||||
}
|
||||
|
||||
function currentCommit() {
|
||||
@@ -1404,7 +1403,7 @@ async function runLiveM3Targets(targets) {
|
||||
function baseReport({ commitId, observedAt }) {
|
||||
return {
|
||||
$schema: "https://hwlab.pikastech.local/schemas/dev-m3-hardware-loop-report.schema.json",
|
||||
$id: "https://hwlab.pikastech.local/reports/dev-gate/dev-m3-hardware-loop.json",
|
||||
$id: "https://hwlab.pikastech.local/dev-gate/dev-m3-hardware-loop.json",
|
||||
reportVersion: "v1",
|
||||
issue,
|
||||
taskId: "dev-m3-hardware-loop",
|
||||
@@ -1618,8 +1617,9 @@ async function ensureContractFiles() {
|
||||
}
|
||||
|
||||
async function writeReport(report, reportPath) {
|
||||
await mkdir(path.dirname(reportPath), { recursive: true });
|
||||
await writeFile(reportPath, `${JSON.stringify(report, null, 2)}\n`, "utf8");
|
||||
const absoluteReportPath = ensureNotRepoReportsPath(repoRoot, reportPath, "report path");
|
||||
await mkdir(path.dirname(absoluteReportPath), { recursive: true });
|
||||
await writeFile(absoluteReportPath, `${JSON.stringify(report, null, 2)}\n`, "utf8");
|
||||
}
|
||||
|
||||
async function main() {
|
||||
|
||||
Reference in New Issue
Block a user