stringray-ai 1.0.38 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugin/architectural-integrity.d.ts +21 -0
- package/dist/plugin/architectural-integrity.d.ts.map +1 -0
- package/dist/plugin/architectural-integrity.js +81 -0
- package/dist/plugin/architectural-integrity.js.map +1 -0
- package/dist/plugin/boot-orchestrator.d.ts +100 -0
- package/dist/plugin/boot-orchestrator.d.ts.map +1 -0
- package/dist/plugin/boot-orchestrator.js +606 -0
- package/dist/plugin/boot-orchestrator.js.map +1 -0
- package/dist/plugin/codex-injector.d.ts +72 -0
- package/dist/plugin/codex-injector.d.ts.map +1 -0
- package/dist/plugin/codex-injector.js +387 -0
- package/dist/plugin/codex-injector.js.map +1 -0
- package/dist/plugin/delegation/index.d.ts +16 -0
- package/dist/plugin/delegation/index.d.ts.map +1 -0
- package/dist/plugin/delegation/index.js +13 -0
- package/dist/plugin/delegation/index.js.map +1 -0
- package/dist/plugin/delegation/session-coordinator.d.ts +121 -0
- package/dist/plugin/delegation/session-coordinator.d.ts.map +1 -0
- package/dist/plugin/delegation/session-coordinator.js +346 -0
- package/dist/plugin/delegation/session-coordinator.js.map +1 -0
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +3 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/monitoring/memory-monitor.d.ts +113 -0
- package/dist/plugin/monitoring/memory-monitor.d.ts.map +1 -0
- package/dist/plugin/monitoring/memory-monitor.js +283 -0
- package/dist/plugin/monitoring/memory-monitor.js.map +1 -0
- package/dist/plugin/postprocessor/PostProcessor.d.ts +90 -0
- package/dist/plugin/postprocessor/PostProcessor.d.ts.map +1 -0
- package/dist/plugin/postprocessor/PostProcessor.js +631 -0
- package/dist/plugin/postprocessor/PostProcessor.js.map +1 -0
- package/dist/plugin/postprocessor/analysis/FailureAnalysisEngine.d.ts +40 -0
- package/dist/plugin/postprocessor/analysis/FailureAnalysisEngine.d.ts.map +1 -0
- package/dist/plugin/postprocessor/analysis/FailureAnalysisEngine.js +244 -0
- package/dist/plugin/postprocessor/analysis/FailureAnalysisEngine.js.map +1 -0
- package/dist/plugin/postprocessor/autofix/AutoFixEngine.d.ts +50 -0
- package/dist/plugin/postprocessor/autofix/AutoFixEngine.d.ts.map +1 -0
- package/dist/plugin/postprocessor/autofix/AutoFixEngine.js +246 -0
- package/dist/plugin/postprocessor/autofix/AutoFixEngine.js.map +1 -0
- package/dist/plugin/postprocessor/autofix/FixValidator.d.ts +27 -0
- package/dist/plugin/postprocessor/autofix/FixValidator.d.ts.map +1 -0
- package/dist/plugin/postprocessor/autofix/FixValidator.js +158 -0
- package/dist/plugin/postprocessor/autofix/FixValidator.js.map +1 -0
- package/dist/plugin/postprocessor/config.d.ts +7 -0
- package/dist/plugin/postprocessor/config.d.ts.map +1 -0
- package/dist/plugin/postprocessor/config.js +66 -0
- package/dist/plugin/postprocessor/config.js.map +1 -0
- package/dist/plugin/postprocessor/escalation/EscalationEngine.d.ts +73 -0
- package/dist/plugin/postprocessor/escalation/EscalationEngine.d.ts.map +1 -0
- package/dist/plugin/postprocessor/escalation/EscalationEngine.js +249 -0
- package/dist/plugin/postprocessor/escalation/EscalationEngine.js.map +1 -0
- package/dist/plugin/postprocessor/monitoring/MonitoringEngine.d.ts +19 -0
- package/dist/plugin/postprocessor/monitoring/MonitoringEngine.d.ts.map +1 -0
- package/dist/plugin/postprocessor/monitoring/MonitoringEngine.js +120 -0
- package/dist/plugin/postprocessor/monitoring/MonitoringEngine.js.map +1 -0
- package/dist/plugin/postprocessor/redeploy/RedeployCoordinator.d.ts +92 -0
- package/dist/plugin/postprocessor/redeploy/RedeployCoordinator.d.ts.map +1 -0
- package/dist/plugin/postprocessor/redeploy/RedeployCoordinator.js +319 -0
- package/dist/plugin/postprocessor/redeploy/RedeployCoordinator.js.map +1 -0
- package/dist/plugin/postprocessor/success/SuccessHandler.d.ts +61 -0
- package/dist/plugin/postprocessor/success/SuccessHandler.d.ts.map +1 -0
- package/dist/plugin/postprocessor/success/SuccessHandler.js +148 -0
- package/dist/plugin/postprocessor/success/SuccessHandler.js.map +1 -0
- package/dist/plugin/postprocessor/triggers/APITrigger.d.ts +13 -0
- package/dist/plugin/postprocessor/triggers/APITrigger.d.ts.map +1 -0
- package/dist/plugin/postprocessor/triggers/APITrigger.js +20 -0
- package/dist/plugin/postprocessor/triggers/APITrigger.js.map +1 -0
- package/dist/plugin/postprocessor/triggers/GitHookTrigger.d.ts +17 -0
- package/dist/plugin/postprocessor/triggers/GitHookTrigger.d.ts.map +1 -0
- package/dist/plugin/postprocessor/triggers/GitHookTrigger.js +285 -0
- package/dist/plugin/postprocessor/triggers/GitHookTrigger.js.map +1 -0
- package/dist/plugin/postprocessor/triggers/WebhookTrigger.d.ts +13 -0
- package/dist/plugin/postprocessor/triggers/WebhookTrigger.d.ts.map +1 -0
- package/dist/plugin/postprocessor/triggers/WebhookTrigger.js +21 -0
- package/dist/plugin/postprocessor/triggers/WebhookTrigger.js.map +1 -0
- package/dist/plugin/postprocessor/types.d.ts +198 -0
- package/dist/plugin/postprocessor/types.d.ts.map +1 -0
- package/dist/plugin/postprocessor/types.js +5 -0
- package/dist/plugin/postprocessor/types.js.map +1 -0
- package/dist/plugin/security/security-auditor.d.ts +57 -0
- package/dist/plugin/security/security-auditor.d.ts.map +1 -0
- package/dist/plugin/security/security-auditor.js +583 -0
- package/dist/plugin/security/security-auditor.js.map +1 -0
- package/dist/plugin/security/security-hardener.d.ts +63 -0
- package/dist/plugin/security/security-hardener.d.ts.map +1 -0
- package/dist/plugin/security/security-hardener.js +181 -0
- package/dist/plugin/security/security-hardener.js.map +1 -0
- package/dist/plugin/security/security-headers.d.ts +52 -0
- package/dist/plugin/security/security-headers.d.ts.map +1 -0
- package/dist/plugin/security/security-headers.js +118 -0
- package/dist/plugin/security/security-headers.js.map +1 -0
- package/dist/plugin/session/session-cleanup-manager.d.ts +118 -0
- package/dist/plugin/session/session-cleanup-manager.d.ts.map +1 -0
- package/dist/plugin/session/session-cleanup-manager.js +324 -0
- package/dist/plugin/session/session-cleanup-manager.js.map +1 -0
- package/dist/plugin/session/session-monitor.d.ts +99 -0
- package/dist/plugin/session/session-monitor.d.ts.map +1 -0
- package/dist/plugin/session/session-monitor.js +363 -0
- package/dist/plugin/session/session-monitor.js.map +1 -0
- package/dist/plugin/session/session-state-manager.d.ts +142 -0
- package/dist/plugin/session/session-state-manager.d.ts.map +1 -0
- package/dist/plugin/session/session-state-manager.js +504 -0
- package/dist/plugin/session/session-state-manager.js.map +1 -0
- package/dist/plugin/strray-activation.d.ts +18 -0
- package/dist/plugin/strray-activation.d.ts.map +1 -0
- package/dist/plugin/strray-activation.js +114 -0
- package/dist/plugin/strray-activation.js.map +1 -0
- package/dist/plugin/validation/report-content-validator.d.ts +43 -0
- package/dist/plugin/validation/report-content-validator.d.ts.map +1 -0
- package/dist/plugin/validation/report-content-validator.js +219 -0
- package/dist/plugin/validation/report-content-validator.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-Processor Monitoring Engine
|
|
3
|
+
*/
|
|
4
|
+
export class PostProcessorMonitoringEngine {
|
|
5
|
+
stateManager;
|
|
6
|
+
sessionMonitor;
|
|
7
|
+
constructor(stateManager, sessionMonitor) {
|
|
8
|
+
this.stateManager = stateManager;
|
|
9
|
+
this.sessionMonitor = sessionMonitor;
|
|
10
|
+
}
|
|
11
|
+
async initialize() {
|
|
12
|
+
// Initialize monitoring components
|
|
13
|
+
console.log("📊 Post-processor monitoring engine initialized");
|
|
14
|
+
}
|
|
15
|
+
async monitorDeployment(commitSha) {
|
|
16
|
+
const startTime = Date.now();
|
|
17
|
+
// Check CI/CD status using existing github-actions-monitor
|
|
18
|
+
const ciStatus = await this.checkCIStatus(commitSha);
|
|
19
|
+
// Check performance metrics
|
|
20
|
+
const performanceStatus = await this.checkPerformanceStatus(commitSha);
|
|
21
|
+
// Check security status
|
|
22
|
+
const securityStatus = await this.checkSecurityStatus(commitSha);
|
|
23
|
+
const overallStatus = this.determineOverallStatus(ciStatus, performanceStatus, securityStatus);
|
|
24
|
+
return {
|
|
25
|
+
commitSha,
|
|
26
|
+
overallStatus,
|
|
27
|
+
timestamp: new Date(),
|
|
28
|
+
ciStatus,
|
|
29
|
+
performanceStatus,
|
|
30
|
+
securityStatus,
|
|
31
|
+
failedJobs: ciStatus.failedJobs,
|
|
32
|
+
duration: Date.now() - startTime,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async checkCIStatus(commitSha) {
|
|
36
|
+
// Use existing GitHub Actions monitor
|
|
37
|
+
try {
|
|
38
|
+
const { execSync } = await import("child_process");
|
|
39
|
+
const output = execSync(`node scripts/github-actions-monitor.cjs --commit ${commitSha}`, {
|
|
40
|
+
encoding: "utf8",
|
|
41
|
+
timeout: 30000,
|
|
42
|
+
});
|
|
43
|
+
// Parse the output to determine status
|
|
44
|
+
if (output.includes("SUCCESS") ||
|
|
45
|
+
output.includes("All workflows passed")) {
|
|
46
|
+
return { status: "success", failedJobs: [] };
|
|
47
|
+
}
|
|
48
|
+
else if (output.includes("FAILURE") || output.includes("failed")) {
|
|
49
|
+
return { status: "failure", failedJobs: ["ci-pipeline"] };
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return { status: "running", failedJobs: [] };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return {
|
|
57
|
+
status: "failure",
|
|
58
|
+
failedJobs: ["ci-pipeline"],
|
|
59
|
+
error: error instanceof Error ? error.message : String(error),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async checkPerformanceStatus(commitSha) {
|
|
64
|
+
// Check if performance tests passed
|
|
65
|
+
try {
|
|
66
|
+
const { execSync } = await import("child_process");
|
|
67
|
+
execSync("npm run test:performance", {
|
|
68
|
+
encoding: "utf8",
|
|
69
|
+
timeout: 120000,
|
|
70
|
+
});
|
|
71
|
+
return { status: "passed", score: 1.0, regressions: [] };
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
return {
|
|
75
|
+
status: "failed",
|
|
76
|
+
score: 0.0,
|
|
77
|
+
regressions: ["performance-tests"],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async checkSecurityStatus(commitSha) {
|
|
82
|
+
// Check for security issues
|
|
83
|
+
try {
|
|
84
|
+
const { execSync } = await import("child_process");
|
|
85
|
+
execSync("npm run security-audit", {
|
|
86
|
+
encoding: "utf8",
|
|
87
|
+
timeout: 60000,
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
status: "passed",
|
|
91
|
+
vulnerabilities: 0,
|
|
92
|
+
criticalVulnerabilities: 0,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
return {
|
|
97
|
+
status: "failed",
|
|
98
|
+
vulnerabilities: 1,
|
|
99
|
+
criticalVulnerabilities: 1,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
determineOverallStatus(ci, performance, security) {
|
|
104
|
+
if (ci.status === "failure" || performance.status === "failed") {
|
|
105
|
+
return "failure";
|
|
106
|
+
}
|
|
107
|
+
if (ci.status === "running") {
|
|
108
|
+
return "running";
|
|
109
|
+
}
|
|
110
|
+
return "success";
|
|
111
|
+
}
|
|
112
|
+
async getStatus() {
|
|
113
|
+
return {
|
|
114
|
+
monitoringEnabled: true,
|
|
115
|
+
activeSessions: 0, // Placeholder
|
|
116
|
+
lastCheck: new Date(),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=MonitoringEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MonitoringEngine.js","sourceRoot":"","sources":["../../../../src/postprocessor/monitoring/M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K,EAAE,GAAG;gBACV,WAAW,EAAE,CAAC,mBAAmB,CAAC;aACnC,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,mBAAmB,CAAC,SAAiB;QACjD,4BAA4B;QAC5B,IAAI,CAAC;YACH,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;YACnD,QAAQ,CAAC,wBAAwB,EAAE;gBACjC,QAAQ,EAAE,MAAM;gBAChB,OAAO,EAAE,KAAK;aACf,CAAC,CAAC;YACH,OAAO;gBACL,MAAM,EAAE,QAAQ;gBAChB,eAAe,EAAE,CAAC;gBAClB,uBAAuB,EAAE,CAAC;aAC3B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,MAAM,EAAE,QAAQ;gBAChB,eAAe,EAAE,CAAC;gBAClB,uBAAuB,EAAE,CAAC;aAC3B,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,sBAAsB,CAC5B,EAAO,EACP,WAAgB,EAChB,QAAa;QAEb,IAAI,EAAE,CAAC,MAAM,KAAK,SAAS,IAAI,WAAW,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/D,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,EAAE,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,SAAS;QACb,OAAO;YACL,iBAAiB,EAAE,IAAI;YACvB,cAAc,EAAE,CAAC,EAAE,cAAc;YACjC,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redeploy Coordinator for Post-Processor
|
|
3
|
+
*/
|
|
4
|
+
import { FixResult, PostProcessorContext } from "../types.js";
|
|
5
|
+
export interface RedeployResult {
|
|
6
|
+
success: boolean;
|
|
7
|
+
deploymentId: string;
|
|
8
|
+
commitSha: string;
|
|
9
|
+
environment: string;
|
|
10
|
+
duration: number;
|
|
11
|
+
error?: string;
|
|
12
|
+
rollbackPerformed?: boolean;
|
|
13
|
+
canaryResults?: CanaryResult[];
|
|
14
|
+
}
|
|
15
|
+
export interface CanaryResult {
|
|
16
|
+
phase: number;
|
|
17
|
+
trafficPercentage: number;
|
|
18
|
+
success: boolean;
|
|
19
|
+
metrics: {
|
|
20
|
+
responseTime: number;
|
|
21
|
+
errorRate: number;
|
|
22
|
+
throughput: number;
|
|
23
|
+
};
|
|
24
|
+
duration: number;
|
|
25
|
+
}
|
|
26
|
+
export interface RedeployConfig {
|
|
27
|
+
maxRetries: number;
|
|
28
|
+
retryDelay: number;
|
|
29
|
+
backoffStrategy: "linear" | "exponential";
|
|
30
|
+
canaryEnabled: boolean;
|
|
31
|
+
canaryPhases: number;
|
|
32
|
+
canaryTrafficIncrement: number;
|
|
33
|
+
healthCheckTimeout: number;
|
|
34
|
+
rollbackOnFailure: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare class RedeployCoordinator {
|
|
37
|
+
private config;
|
|
38
|
+
constructor(config?: Partial<RedeployConfig>);
|
|
39
|
+
/**
|
|
40
|
+
* Execute redeployment with fixes
|
|
41
|
+
*/
|
|
42
|
+
executeRedeploy(context: PostProcessorContext, fixResult: FixResult): Promise<RedeployResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Validate pre-deployment requirements
|
|
45
|
+
*/
|
|
46
|
+
private validatePreDeployment;
|
|
47
|
+
/**
|
|
48
|
+
* Execute deployment with retry logic
|
|
49
|
+
*/
|
|
50
|
+
private deployWithRetry;
|
|
51
|
+
/**
|
|
52
|
+
* Execute canary deployment with progressive traffic rollout
|
|
53
|
+
*/
|
|
54
|
+
private executeCanaryDeployment;
|
|
55
|
+
/**
|
|
56
|
+
* Execute direct deployment (no canary)
|
|
57
|
+
*/
|
|
58
|
+
private executeDirectDeployment;
|
|
59
|
+
/**
|
|
60
|
+
* Deploy to canary environment
|
|
61
|
+
*/
|
|
62
|
+
private deployToCanary;
|
|
63
|
+
/**
|
|
64
|
+
* Monitor canary health during deployment
|
|
65
|
+
*/
|
|
66
|
+
private monitorCanaryHealth;
|
|
67
|
+
/**
|
|
68
|
+
* Check if canary metrics indicate healthy deployment
|
|
69
|
+
*/
|
|
70
|
+
private isCanaryHealthy;
|
|
71
|
+
/**
|
|
72
|
+
* Wait between canary phases
|
|
73
|
+
*/
|
|
74
|
+
private waitBetweenPhases;
|
|
75
|
+
/**
|
|
76
|
+
* Promote canary deployment to production
|
|
77
|
+
*/
|
|
78
|
+
private promoteToProduction;
|
|
79
|
+
/**
|
|
80
|
+
* Validate post-deployment health
|
|
81
|
+
*/
|
|
82
|
+
private validatePostDeployment;
|
|
83
|
+
/**
|
|
84
|
+
* Rollback deployment on failure
|
|
85
|
+
*/
|
|
86
|
+
private rollbackDeployment;
|
|
87
|
+
/**
|
|
88
|
+
* Calculate wait time before retry using backoff strategy
|
|
89
|
+
*/
|
|
90
|
+
private waitBeforeRetry;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=RedeployCoordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedeployCoordinator.d.ts","sourceRoot":"","sources":["../../../../src/postprocessor/redeploy/RedeployCoordinator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG9D,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,Y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|
+
*/
|
|
4
|
+
import { execSync } from "child_process";
|
|
5
|
+
export class RedeployCoordinator {
|
|
6
|
+
config;
|
|
7
|
+
constructor(config = {}) {
|
|
8
|
+
this.config = {
|
|
9
|
+
maxRetries: 3,
|
|
10
|
+
retryDelay: 30000,
|
|
11
|
+
backoffStrategy: "exponential",
|
|
12
|
+
canaryEnabled: true,
|
|
13
|
+
canaryPhases: 3,
|
|
14
|
+
canaryTrafficIncrement: 25,
|
|
15
|
+
healthCheckTimeout: 60000,
|
|
16
|
+
rollbackOnFailure: true,
|
|
17
|
+
...config,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Execute redeployment with fixes
|
|
22
|
+
*/
|
|
23
|
+
async executeRedeploy(context, fixResult) {
|
|
24
|
+
const deploymentId = `deploy-${context.commitSha}-${Date.now()}`;
|
|
25
|
+
const startTime = Date.now();
|
|
26
|
+
console.log(`🚀 Starting redeployment ${deploymentId} for commit ${context.commitSha}`);
|
|
27
|
+
try {
|
|
28
|
+
// Pre-deployment validation
|
|
29
|
+
await this.validatePreDeployment(context, fixResult);
|
|
30
|
+
// Execute deployment with retry logic
|
|
31
|
+
const deployResult = await this.deployWithRetry(context, deploymentId);
|
|
32
|
+
// Post-deployment validation
|
|
33
|
+
const validationResult = await this.validatePostDeployment(deployResult);
|
|
34
|
+
if (validationResult.success) {
|
|
35
|
+
console.log(`✅ Redeployment ${deploymentId} completed successfully`);
|
|
36
|
+
const result = {
|
|
37
|
+
success: true,
|
|
38
|
+
deploymentId,
|
|
39
|
+
commitSha: context.commitSha,
|
|
40
|
+
environment: "production", // Could be configurable
|
|
41
|
+
duration: Date.now() - startTime,
|
|
42
|
+
};
|
|
43
|
+
if (deployResult.canaryResults) {
|
|
44
|
+
result.canaryResults = deployResult.canaryResults;
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// Deployment validation failed - rollback if enabled
|
|
50
|
+
if (this.config.rollbackOnFailure) {
|
|
51
|
+
console.log("❌ Deployment validation failed - initiating rollback");
|
|
52
|
+
await this.rollbackDeployment(deploymentId, context);
|
|
53
|
+
const result = {
|
|
54
|
+
success: false,
|
|
55
|
+
deploymentId,
|
|
56
|
+
commitSha: context.commitSha,
|
|
57
|
+
environment: "production",
|
|
58
|
+
duration: Date.now() - startTime,
|
|
59
|
+
error: validationResult.error || "Deployment validation failed",
|
|
60
|
+
rollbackPerformed: true,
|
|
61
|
+
};
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return {
|
|
66
|
+
success: false,
|
|
67
|
+
deploymentId,
|
|
68
|
+
commitSha: context.commitSha,
|
|
69
|
+
environment: "production",
|
|
70
|
+
duration: Date.now() - startTime,
|
|
71
|
+
error: validationResult.error,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
console.error(`❌ Redeployment ${deploymentId} failed:`, error);
|
|
78
|
+
return {
|
|
79
|
+
success: false,
|
|
80
|
+
deploymentId,
|
|
81
|
+
commitSha: context.commitSha,
|
|
82
|
+
environment: "production",
|
|
83
|
+
duration: Date.now() - startTime,
|
|
84
|
+
error: error instanceof Error ? error.message : String(error),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Validate pre-deployment requirements
|
|
90
|
+
*/
|
|
91
|
+
async validatePreDeployment(context, fixResult) {
|
|
92
|
+
console.log("🔍 Validating pre-deployment requirements...");
|
|
93
|
+
// Ensure all fixes were successfully applied
|
|
94
|
+
if (!fixResult.success) {
|
|
95
|
+
throw new Error("Cannot redeploy: fixes were not successfully applied");
|
|
96
|
+
}
|
|
97
|
+
// Validate that the commit exists and is properly formatted
|
|
98
|
+
try {
|
|
99
|
+
execSync(`git rev-parse --verify ${context.commitSha}`, {
|
|
100
|
+
stdio: "pipe",
|
|
101
|
+
timeout: 10000,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
throw new Error(`Invalid commit SHA: ${context.commitSha}`);
|
|
106
|
+
}
|
|
107
|
+
// Check if deployment environment is available
|
|
108
|
+
// This would integrate with actual deployment infrastructure
|
|
109
|
+
console.log("✅ Pre-deployment validation passed");
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Execute deployment with retry logic
|
|
113
|
+
*/
|
|
114
|
+
async deployWithRetry(context, deploymentId) {
|
|
115
|
+
let attempt = 0;
|
|
116
|
+
const maxRetries = this.config.maxRetries;
|
|
117
|
+
while (attempt < maxRetries) {
|
|
118
|
+
try {
|
|
119
|
+
console.log(`🔄 Deployment attempt ${attempt + 1}/${maxRetries} for ${deploymentId}`);
|
|
120
|
+
if (this.config.canaryEnabled) {
|
|
121
|
+
// Execute canary deployment
|
|
122
|
+
const canaryResults = await this.executeCanaryDeployment(context, deploymentId);
|
|
123
|
+
return { canaryResults };
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
// Execute direct deployment
|
|
127
|
+
await this.executeDirectDeployment(context, deploymentId);
|
|
128
|
+
return {};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
console.log(`❌ Deployment attempt ${attempt + 1} failed:`, error);
|
|
133
|
+
if (attempt === maxRetries - 1) {
|
|
134
|
+
throw error; // Final attempt failed
|
|
135
|
+
}
|
|
136
|
+
// Wait before retry
|
|
137
|
+
await this.waitBeforeRetry(attempt);
|
|
138
|
+
attempt++;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
throw new Error(`Deployment failed after ${maxRetries} attempts`);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Execute canary deployment with progressive traffic rollout
|
|
145
|
+
*/
|
|
146
|
+
async executeCanaryDeployment(context, deploymentId) {
|
|
147
|
+
const results = [];
|
|
148
|
+
const phases = this.config.canaryPhases;
|
|
149
|
+
console.log(`🎯 Executing canary deployment with ${phases} phases`);
|
|
150
|
+
for (let phase = 1; phase <= phases; phase++) {
|
|
151
|
+
const trafficPercentage = Math.min(phase * this.config.canaryTrafficIncrement, 100);
|
|
152
|
+
console.log(`📊 Canary Phase ${phase}/${phases}: ${trafficPercentage}% traffic`);
|
|
153
|
+
const phaseStartTime = Date.now();
|
|
154
|
+
try {
|
|
155
|
+
// Deploy to canary subset
|
|
156
|
+
await this.deployToCanary(context, deploymentId, phase, trafficPercentage);
|
|
157
|
+
// Monitor canary health
|
|
158
|
+
const metrics = await this.monitorCanaryHealth(phase, this.config.healthCheckTimeout);
|
|
159
|
+
const phaseResult = {
|
|
160
|
+
phase,
|
|
161
|
+
trafficPercentage,
|
|
162
|
+
success: this.isCanaryHealthy(metrics),
|
|
163
|
+
metrics,
|
|
164
|
+
duration: Date.now() - phaseStartTime,
|
|
165
|
+
};
|
|
166
|
+
results.push(phaseResult);
|
|
167
|
+
if (!phaseResult.success) {
|
|
168
|
+
throw new Error(`Canary phase ${phase} failed health checks`);
|
|
169
|
+
}
|
|
170
|
+
console.log(`✅ Canary Phase ${phase} successful (${phaseResult.duration}ms)`);
|
|
171
|
+
// Wait between phases for observation
|
|
172
|
+
if (phase < phases) {
|
|
173
|
+
await this.waitBetweenPhases();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
console.log(`❌ Canary Phase ${phase} failed:`, error);
|
|
178
|
+
throw error;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// All phases successful - complete deployment
|
|
182
|
+
await this.promoteToProduction(context, deploymentId);
|
|
183
|
+
console.log("🎉 Canary deployment completed - promoted to production");
|
|
184
|
+
return results;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Execute direct deployment (no canary)
|
|
188
|
+
*/
|
|
189
|
+
async executeDirectDeployment(context, deploymentId) {
|
|
190
|
+
console.log(`🚀 Executing direct deployment for ${deploymentId}`);
|
|
191
|
+
// For this implementation, we'll simulate deployment by pushing to trigger CI/CD
|
|
192
|
+
// In a real system, this would integrate with deployment APIs
|
|
193
|
+
// Trigger a new CI/CD run to validate the fixes
|
|
194
|
+
try {
|
|
195
|
+
execSync("git push origin master", {
|
|
196
|
+
stdio: "pipe",
|
|
197
|
+
timeout: 30000,
|
|
198
|
+
});
|
|
199
|
+
console.log("✅ Deployment triggered via git push");
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
throw new Error(`Deployment trigger failed: ${error}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Deploy to canary environment
|
|
207
|
+
*/
|
|
208
|
+
async deployToCanary(context, deploymentId, phase, trafficPercentage) {
|
|
209
|
+
// Placeholder for canary deployment logic
|
|
210
|
+
// In a real system, this would integrate with load balancers, service meshes, etc.
|
|
211
|
+
console.log(`🚢 Deploying ${trafficPercentage}% traffic to canary for phase ${phase}`);
|
|
212
|
+
// Simulate deployment time
|
|
213
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Monitor canary health during deployment
|
|
217
|
+
*/
|
|
218
|
+
async monitorCanaryHealth(phase, timeout) {
|
|
219
|
+
console.log(`📊 Monitoring canary health for phase ${phase} (${timeout}ms timeout)`);
|
|
220
|
+
// Placeholder for health monitoring
|
|
221
|
+
// In a real system, this would check metrics from monitoring systems
|
|
222
|
+
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
223
|
+
// Simulate health metrics
|
|
224
|
+
return {
|
|
225
|
+
responseTime: 150 + Math.random() * 50, // 150-200ms
|
|
226
|
+
errorRate: Math.random() * 0.01, // 0-1%
|
|
227
|
+
throughput: 1000 + Math.random() * 500, // 1000-1500 req/s
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Check if canary metrics indicate healthy deployment
|
|
232
|
+
*/
|
|
233
|
+
isCanaryHealthy(metrics) {
|
|
234
|
+
const { responseTime, errorRate, throughput } = metrics;
|
|
235
|
+
// Define health thresholds
|
|
236
|
+
const maxResponseTime = 300; // ms
|
|
237
|
+
const maxErrorRate = 0.05; // 5%
|
|
238
|
+
const minThroughput = 800; // req/s
|
|
239
|
+
return (responseTime <= maxResponseTime &&
|
|
240
|
+
errorRate <= maxErrorRate &&
|
|
241
|
+
throughput >= minThroughput);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Wait between canary phases
|
|
245
|
+
*/
|
|
246
|
+
async waitBetweenPhases() {
|
|
247
|
+
const waitTime = 10000; // 10 seconds
|
|
248
|
+
console.log(`⏳ Waiting ${waitTime}ms between canary phases...`);
|
|
249
|
+
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Promote canary deployment to production
|
|
253
|
+
*/
|
|
254
|
+
async promoteToProduction(context, deploymentId) {
|
|
255
|
+
console.log("🎯 Promoting canary deployment to production");
|
|
256
|
+
// Placeholder for production promotion
|
|
257
|
+
// In a real system, this would route 100% traffic to the new version
|
|
258
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Validate post-deployment health
|
|
262
|
+
*/
|
|
263
|
+
async validatePostDeployment(deployResult) {
|
|
264
|
+
console.log("🔍 Validating post-deployment health...");
|
|
265
|
+
try {
|
|
266
|
+
// Run post-deployment health checks
|
|
267
|
+
// This could include API endpoint checks, database connectivity, etc.
|
|
268
|
+
// For now, simulate a basic health check
|
|
269
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
270
|
+
console.log("✅ Post-deployment validation passed");
|
|
271
|
+
return { success: true, error: "" };
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
console.log("❌ Post-deployment validation failed");
|
|
275
|
+
return {
|
|
276
|
+
success: false,
|
|
277
|
+
error: error instanceof Error ? error.message : String(error),
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Rollback deployment on failure
|
|
283
|
+
*/
|
|
284
|
+
async rollbackDeployment(deploymentId, context) {
|
|
285
|
+
console.log(`🔄 Rolling back deployment ${deploymentId}`);
|
|
286
|
+
try {
|
|
287
|
+
// Placeholder for rollback logic
|
|
288
|
+
// In a real system, this would revert to the previous version
|
|
289
|
+
// For this implementation, we could revert the git commit
|
|
290
|
+
execSync("git reset --hard HEAD~1", {
|
|
291
|
+
stdio: "pipe",
|
|
292
|
+
timeout: 10000,
|
|
293
|
+
});
|
|
294
|
+
console.log("✅ Deployment rolled back successfully");
|
|
295
|
+
}
|
|
296
|
+
catch (error) {
|
|
297
|
+
console.error("❌ Rollback failed:", error);
|
|
298
|
+
throw new Error(`Rollback failed: ${error}`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Calculate wait time before retry using backoff strategy
|
|
303
|
+
*/
|
|
304
|
+
async waitBeforeRetry(attempt) {
|
|
305
|
+
const baseDelay = this.config.retryDelay;
|
|
306
|
+
let delay;
|
|
307
|
+
if (this.config.backoffStrategy === "exponential") {
|
|
308
|
+
delay = baseDelay * Math.pow(2, attempt);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
delay = baseDelay * (attempt + 1);
|
|
312
|
+
}
|
|
313
|
+
// Cap maximum delay at 5 minutes
|
|
314
|
+
delay = Math.min(delay, 300000);
|
|
315
|
+
console.log(`⏳ Waiting ${delay}ms before retry (attempt ${attempt + 1})`);
|
|
316
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=RedeployCoordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedeployCoordinator.js","sourceRoot":"","sources":["../../../../src/postprocessor/redeploy/RedeployCoordinator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,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CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,KAAK,GAAG,SAAS,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;QACpC,CAAC;QAED,iCAAiC;QACjC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAEhC,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,4BAA4B,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1E,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IAC7D,CAAC;CACF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Success Handler for Post-Processor
|
|
3
|
+
* Handles successful completion, cleanup, and success confirmation
|
|
4
|
+
*/
|
|
5
|
+
import { PostProcessorContext, PostProcessorResult } from "../types.js";
|
|
6
|
+
export interface SuccessConfig {
|
|
7
|
+
successConfirmation: boolean;
|
|
8
|
+
cleanupEnabled: boolean;
|
|
9
|
+
notificationEnabled: boolean;
|
|
10
|
+
metricsCollection: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SuccessMetrics {
|
|
13
|
+
totalDuration: number;
|
|
14
|
+
attempts: number;
|
|
15
|
+
fixesApplied: number;
|
|
16
|
+
monitoringChecks: number;
|
|
17
|
+
redeployments: number;
|
|
18
|
+
timestamp: Date;
|
|
19
|
+
}
|
|
20
|
+
export declare class SuccessHandler {
|
|
21
|
+
private config;
|
|
22
|
+
constructor(config?: Partial<SuccessConfig>);
|
|
23
|
+
/**
|
|
24
|
+
* Handle successful completion of the post-processor loop
|
|
25
|
+
*/
|
|
26
|
+
handleSuccess(context: PostProcessorContext, result: PostProcessorResult, monitoringResults: any[]): Promise<SuccessMetrics>;
|
|
27
|
+
/**
|
|
28
|
+
* Confirm that the success is legitimate
|
|
29
|
+
*/
|
|
30
|
+
private confirmSuccess;
|
|
31
|
+
/**
|
|
32
|
+
* Send success notifications
|
|
33
|
+
*/
|
|
34
|
+
private sendSuccessNotifications;
|
|
35
|
+
/**
|
|
36
|
+
* Perform cleanup after successful completion
|
|
37
|
+
*/
|
|
38
|
+
private performCleanup;
|
|
39
|
+
/**
|
|
40
|
+
* Collect comprehensive success metrics
|
|
41
|
+
*/
|
|
42
|
+
private collectSuccessMetrics;
|
|
43
|
+
/**
|
|
44
|
+
* Log success metrics for analysis
|
|
45
|
+
*/
|
|
46
|
+
private logSuccessMetrics;
|
|
47
|
+
/**
|
|
48
|
+
* Generate success summary report
|
|
49
|
+
*/
|
|
50
|
+
generateSuccessReport(context: PostProcessorContext, result: PostProcessorResult, metrics: SuccessMetrics): string;
|
|
51
|
+
/**
|
|
52
|
+
* Get success statistics
|
|
53
|
+
*/
|
|
54
|
+
getStats(): {
|
|
55
|
+
successConfirmation: boolean;
|
|
56
|
+
cleanupEnabled: boolean;
|
|
57
|
+
notificationEnabled: boolean;
|
|
58
|
+
metricsCollection: boolean;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=SuccessHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuccessHandler.d.ts","sourceRoot":"","sources":["../../../../src/postprocessor/success/SuccessHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAExE,MAAM,WAAW,aAAa;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,EAAE,OAAO,CAAC;IACxB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,gBA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