48 lines
1.7 KiB
JavaScript
48 lines
1.7 KiB
JavaScript
|
|
#!/usr/bin/env node
|
||
|
|
// ═══════════════════════════════════════════════════════════════════════════
|
||
|
|
// Vertical Slice: Deployment utan pipeline blockeras (S-003) v2
|
||
|
|
// Med Policy Registry och Runtime Trace v2
|
||
|
|
// ═══════════════════════════════════════════════════════════════════════════
|
||
|
|
|
||
|
|
import { AgentRuntimeV3 } from './agent-runtime-v3.mjs';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* EOS Policy för deployment med Policy Registry-integration
|
||
|
|
*/
|
||
|
|
function checkPipelinePolicy(task) {
|
||
|
|
const isDeployment = task.type === 'deployment' ||
|
||
|
|
task.description?.toLowerCase().includes('deploy');
|
||
|
|
|
||
|
|
const isProduction = task.target === 'production' ||
|
||
|
|
task.description?.toLowerCase().includes('produktion');
|
||
|
|
|
||
|
|
const hasPipeline = task.pipeline !== undefined && task.pipeline !== null;
|
||
|
|
|
||
|
|
if (isDeployment && isProduction && !hasPipeline) {
|
||
|
|
return {
|
||
|
|
passed: false,
|
||
|
|
policyId: 'POL-DEP-001',
|
||
|
|
rule: 'pipeline-required',
|
||
|
|
reason: 'Deployment till produktion kräver godkänd CI/CD-pipeline enligt EOS Policy POL-DEP-001',
|
||
|
|
severity: 'CRITICAL',
|
||
|
|
action: 'STOP',
|
||
|
|
evidence: {
|
||
|
|
type: task.type,
|
||
|
|
target: task.target,
|
||
|
|
pipeline: task.pipeline
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
return { passed: true };
|
||
|
|
}
|
||
|
|
|
||
|
|
class AgentRuntimeDeploySliceV2 extends AgentRuntimeV3 {
|
||
|
|
constructor(task) {
|
||
|
|
super(task);
|
||
|
|
this.policies = [checkPipelinePolicy];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export { AgentRuntimeDeploySliceV2, checkPipelinePolicy };
|