fix(cicd): isolate bounded worker result paths

This commit is contained in:
pikastech
2026-07-21 08:53:31 +02:00
parent d839b2cdfc
commit 0c3efee932
2 changed files with 10 additions and 1 deletions
@@ -43,12 +43,17 @@ function applyPipelineBuildQueue(doc) {
let workerScript = publish.script
.replaceAll('$(params.service-id)', '$service_id')
.replaceAll('/workspace/service-work', '/workspace/service-work/$service_id')
.replaceAll('/tekton/results', '/workspace/service-results-tekton/$service_id');
.replaceAll('"/tekton/results/" + name', 'process.env.HWLAB_TEKTON_RESULTS_DIR + "/" + name')
.replaceAll('--tekton-results-dir /tekton/results', '--tekton-results-dir "$HWLAB_TEKTON_RESULTS_DIR"');
if (workerScript.includes('/tekton/results')) {
throw new Error(`CI resource governance task ${governance.matrixTaskName} contains an unsupported Tekton result path context`);
}
publish.script = [
'set -eu',
'build_service() {',
' service_id="$1"',
' mkdir -p "/workspace/service-work/$service_id" "/workspace/service-results-tekton/$service_id"',
' export HWLAB_TEKTON_RESULTS_DIR="/workspace/service-results-tekton/$service_id"',
// Keep the worker body at column zero: POSIX heredoc terminators in the
// generated publish script must not be indented by the function wrapper.
workerScript,
@@ -292,6 +292,10 @@ test("bounded HWLAB build worker wrapper preserves heredoc terminators", () => {
const source = readFileSync(resolve(import.meta.dir, "../native/hwlab/runtime-pipeline-resource-governance.mjs"), "utf8");
expect(source).toContain("workerScript,");
expect(source).not.toContain("workerScript.split('\\n').map((line) => ` ${line}`).join('\\n')");
expect(source).toContain('export HWLAB_TEKTON_RESULTS_DIR="/workspace/service-results-tekton/$service_id"');
expect(source).toContain('process.env.HWLAB_TEKTON_RESULTS_DIR + "/" + name');
expect(source).toContain('--tekton-results-dir "$HWLAB_TEKTON_RESULTS_DIR"');
expect(source).toContain("contains an unsupported Tekton result path context");
});
test("L2/L3 release exposes plan first and trigger only sends the PaC webhook", async () => {