新增 release artifact URL workflow action plan API
This commit is contained in:
@@ -57,6 +57,7 @@ import {
|
||||
createProjectReleaseGateManifest,
|
||||
createProjectReleaseGateResultMatrix,
|
||||
createProjectReleaseReadinessArtifactJsonWorkflow,
|
||||
createProjectReleaseReadinessArtifactUrlWorkflowActionPlan,
|
||||
createProjectReleaseReadinessArtifactUrlWorkflowSummaryViewModel,
|
||||
createProjectReleaseReadinessArtifactValidation,
|
||||
createProjectReleaseReadinessArtifactValidationActionPlan,
|
||||
@@ -252,10 +253,15 @@ action-plan output without executing release gates.
|
||||
`createProjectReleaseReadinessArtifactUrlWorkflowSummaryViewModel()` turns the
|
||||
URL workflow result into stable dashboard status text and rows for ready,
|
||||
missing-input, fetch-failure, and artifact-validation-blocked states.
|
||||
`createProjectReleaseReadinessArtifactUrlWorkflowActionPlan()` turns the same
|
||||
URL workflow into ordered workflow-level actions, distinguishing caller input,
|
||||
fetch checks, and executable gate commands while preserving a shell script for
|
||||
command actions.
|
||||
`tests/sdk/node/verify_project_release_artifact_url_workflow.sh` is the
|
||||
dedicated executable SDK gate for that URL workflow. It verifies caller-provided
|
||||
fetch handling, ready summaries, missing input, HTTP failure, thrown fetch
|
||||
errors, and ends with `project_release_artifact_url_workflow_node_smoke=ok`.
|
||||
fetch handling, ready summaries, action plans, missing input, HTTP failure,
|
||||
thrown fetch errors, and ends with
|
||||
`project_release_artifact_url_workflow_node_smoke=ok`.
|
||||
|
||||
## OPFS/session persistence exports
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ export {
|
||||
createProjectReleaseGateManifest,
|
||||
createProjectReleaseGateResultMatrix,
|
||||
createProjectReleaseReadinessArtifactJsonWorkflow,
|
||||
createProjectReleaseReadinessArtifactUrlWorkflowActionPlan,
|
||||
createProjectReleaseReadinessArtifactUrlWorkflowSummaryViewModel,
|
||||
createProjectReleaseReadinessArtifactValidation,
|
||||
createProjectReleaseReadinessArtifactValidationActionPlan,
|
||||
|
||||
@@ -727,6 +727,88 @@ export function createProjectReleaseReadinessArtifactUrlWorkflowSummaryViewModel
|
||||
};
|
||||
}
|
||||
|
||||
export function createProjectReleaseReadinessArtifactUrlWorkflowActionPlan(
|
||||
workflow = {},
|
||||
) {
|
||||
const missing = arrayOrEmpty(workflow?.missing);
|
||||
const ready = workflow?.ready === true;
|
||||
const validationCommands = arrayOrEmpty(workflow?.actionPlan?.commands);
|
||||
const inputActions = [
|
||||
...(missing.includes("artifact-url")
|
||||
? [{
|
||||
id: "provide-artifact-url",
|
||||
label: "Provide release readiness artifact URL",
|
||||
kind: "input",
|
||||
command: null,
|
||||
expectedOutput: null,
|
||||
}]
|
||||
: []),
|
||||
...(missing.includes("fetch")
|
||||
? [{
|
||||
id: "provide-fetch",
|
||||
label: "Provide fetch implementation",
|
||||
kind: "input",
|
||||
command: null,
|
||||
expectedOutput: null,
|
||||
}]
|
||||
: []),
|
||||
...(missing.includes("artifact-fetch")
|
||||
? [{
|
||||
id: "verify-artifact-url-fetch",
|
||||
label: "Verify release readiness artifact URL fetch",
|
||||
kind: "fetch",
|
||||
command: null,
|
||||
expectedOutput: null,
|
||||
}]
|
||||
: []),
|
||||
];
|
||||
const commandActions = validationCommands.map((command) => ({
|
||||
id: command.id ?? command.gateId ?? `command-${command.step}`,
|
||||
label: command.label,
|
||||
kind: "command",
|
||||
command: command.command,
|
||||
expectedOutput: command.expectedOutput ?? null,
|
||||
}));
|
||||
const actions = ready ? [] : [...inputActions, ...commandActions].map((action, index) => ({
|
||||
step: index + 1,
|
||||
...action,
|
||||
}));
|
||||
const commands = actions.filter(({ command }) => typeof command === "string" && command.length > 0);
|
||||
const shellScript = commands.length > 0
|
||||
? [
|
||||
"#!/usr/bin/env bash",
|
||||
"set -euo pipefail",
|
||||
"",
|
||||
...commands.map(({ command }) => command),
|
||||
"",
|
||||
].join("\n")
|
||||
: (ready
|
||||
? "# Project release readiness artifact URL workflow is already ready.\n"
|
||||
: "# Project release readiness artifact URL workflow requires non-shell input.\n");
|
||||
|
||||
return {
|
||||
apiName: "project-release-readiness-artifact-url-workflow-action-plan",
|
||||
planVersion: 1,
|
||||
phase: ready ? "ready" : "blocked",
|
||||
ready,
|
||||
missing,
|
||||
actionCount: actions.length,
|
||||
commandCount: commands.length,
|
||||
nextActionId: actions[0]?.id ?? null,
|
||||
nextCommand: commands[0]?.command ?? null,
|
||||
actions,
|
||||
commands,
|
||||
shellScript,
|
||||
rows: actions.map(({ id, label, kind, command, expectedOutput }) => ({
|
||||
id,
|
||||
label,
|
||||
kind,
|
||||
value: command ?? kind,
|
||||
expectedOutput,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
export function createProjectReleaseReadinessArtifactValidation(artifact = {}) {
|
||||
const artifactObject = objectOrEmpty(artifact);
|
||||
const releaseGate = objectOrEmpty(artifactObject.releaseGate);
|
||||
|
||||
Reference in New Issue
Block a user