feat(workflow): add risk-based release gates
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env node
|
||||
import { executeImpactReleaseGate, parseRunnerArgs } from '../release-gate/runner.mjs';
|
||||
|
||||
function usage() {
|
||||
console.log(`Usage:
|
||||
node scripts/run-release-gate-impact.mjs --artifact .runtime/portal --deployed-commit <sha>
|
||||
|
||||
Runs the compact production core Gate plus scenarios selected from the Git diff.
|
||||
Critical, shared, or unmapped runtime changes automatically expand to the full catalog.`);
|
||||
}
|
||||
|
||||
try {
|
||||
const options = parseRunnerArgs(process.argv);
|
||||
if (options.help) {
|
||||
usage();
|
||||
process.exit(0);
|
||||
}
|
||||
options.mode = 'impact';
|
||||
const { report, outputDir, selection } = await executeImpactReleaseGate(options);
|
||||
const summary = report.summary;
|
||||
console.log(`Risk-based release gate report: ${outputDir}`);
|
||||
console.log(`mode=${report.mode}`);
|
||||
if (selection) {
|
||||
console.log(`strategy=${selection.strategy}`);
|
||||
console.log(`selected=${selection.selected_total}/${selection.catalog_total}`);
|
||||
console.log(`impact_groups=${selection.impact_groups.join(',') || 'none'}`);
|
||||
console.log(`changed_paths=${selection.changed_paths.length}`);
|
||||
} else {
|
||||
console.log('strategy=full');
|
||||
console.log('reason=deployed_commit_unavailable');
|
||||
}
|
||||
console.log(JSON.stringify(summary));
|
||||
const passed = summary.failed === 0
|
||||
&& summary.skipped === 0
|
||||
&& summary.blocked === 0
|
||||
&& summary.unknown === 0
|
||||
&& summary.cleanup_failed === 0
|
||||
&& summary.passed === summary.required;
|
||||
process.exit(passed ? 0 : 1);
|
||||
} catch (error) {
|
||||
console.error(`Risk-based release gate failed: ${error.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user