pi-cicd 1.0.5 → 1.0.7
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.
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# US-001: Intelligent Deploy Tool
|
|
2
|
+
|
|
3
|
+
## User Story
|
|
4
|
+
As an agent, I want to monitor CI/CD pipelines, manage canary deployments, and track landing queues so that I can safely deploy changes to production.
|
|
5
|
+
|
|
6
|
+
## Status
|
|
7
|
+
- [x] Implemented
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
- `/ci` - CI status command
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
- CI run tracking
|
|
14
|
+
- Canary deployment support
|
|
15
|
+
- Landing queue management
|
|
16
|
+
- Exit code resolution
|
|
17
|
+
|
|
18
|
+
## Triggers
|
|
19
|
+
- "deploy", "canary", "rollout", "landing queue", "production"
|
|
20
|
+
|
|
21
|
+
## Acceptance Criteria
|
|
22
|
+
- [x] CI status command shows run information
|
|
23
|
+
- [x] Exit codes are properly resolved
|
|
24
|
+
- [x] Can track deployment progress
|
|
25
|
+
|
|
26
|
+
## Notes
|
|
27
|
+
See `skills/intelligent-deploy/SKILL.md` for detailed usage.
|
package/package.json
CHANGED
|
@@ -1,229 +1,144 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: intelligent-deploy
|
|
3
|
-
description:
|
|
3
|
+
description: CI/CD pipeline monitoring, canary deployment management, and landing queue orchestration
|
|
4
4
|
triggers:
|
|
5
5
|
- deploy
|
|
6
6
|
- canary
|
|
7
7
|
- rollout
|
|
8
8
|
- landing queue
|
|
9
9
|
- production
|
|
10
|
+
- CI status
|
|
11
|
+
- pipeline
|
|
12
|
+
- release
|
|
13
|
+
- build
|
|
10
14
|
requirements:
|
|
11
15
|
tools: [bash]
|
|
12
|
-
context: [deployment
|
|
16
|
+
context: [CI configuration, deployment scripts]
|
|
13
17
|
---
|
|
14
18
|
|
|
15
19
|
# Intelligent Deploy Skill
|
|
16
20
|
|
|
17
21
|
## Objective
|
|
18
|
-
|
|
22
|
+
Monitor CI/CD pipelines, manage canary deployments, and track landing queues for safe production releases.
|
|
19
23
|
|
|
20
|
-
##
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- When managing multiple deployments
|
|
24
|
-
- When requiring gradual rollouts with monitoring
|
|
25
|
-
|
|
26
|
-
## Workflow
|
|
27
|
-
|
|
28
|
-
### Step 1: Canary Deployment
|
|
29
|
-
```typescript
|
|
30
|
-
import { CanaryDeploy } from '../../src/deploy/canary-deploy';
|
|
31
|
-
|
|
32
|
-
const canary = new CanaryDeploy({
|
|
33
|
-
initialPercentage: 10,
|
|
34
|
-
incrementPercentage: 10,
|
|
35
|
-
stepInterval: 60000, // 1 minute
|
|
36
|
-
totalDuration: 300000, // 5 minutes
|
|
37
|
-
metrics: {
|
|
38
|
-
successRate: { min: 95 },
|
|
39
|
-
latency: { max: 500 },
|
|
40
|
-
errorRate: { max: 5 },
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const result = await canary.deploy({
|
|
45
|
-
name: 'production',
|
|
46
|
-
url: 'https://api.example.com',
|
|
47
|
-
healthy: true,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
console.log(canary.formatReport(result));
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Step 2: Landing Queue
|
|
54
|
-
```typescript
|
|
55
|
-
import { LandingQueue } from '../../src/deploy/landing-queue';
|
|
24
|
+
## Tools Available
|
|
25
|
+
- `/ci` command - Show CI status and run information
|
|
26
|
+
- `bash` - For running CI scripts and deployment commands
|
|
56
27
|
|
|
57
|
-
|
|
28
|
+
## When to Use
|
|
29
|
+
- When deploying to production
|
|
30
|
+
- When monitoring CI/CD pipelines
|
|
31
|
+
- When managing canary releases
|
|
32
|
+
- When tracking landing queues
|
|
33
|
+
- When investigating build failures
|
|
34
|
+
- When checking deployment status
|
|
58
35
|
|
|
59
|
-
|
|
60
|
-
queue.enqueue('v1.2.0', 'production', 'New feature release');
|
|
61
|
-
queue.enqueue('v1.2.1', 'production', 'Bug fix');
|
|
36
|
+
## CI Status Command
|
|
62
37
|
|
|
63
|
-
|
|
64
|
-
while (true) {
|
|
65
|
-
const next = await queue.startNext();
|
|
66
|
-
if (!next) break;
|
|
67
|
-
|
|
68
|
-
// Deploy
|
|
69
|
-
const success = await deploy(next);
|
|
70
|
-
|
|
71
|
-
// Mark complete
|
|
72
|
-
queue.complete(next.id, success);
|
|
73
|
-
|
|
74
|
-
if (!success) break; // Stop on failure
|
|
75
|
-
}
|
|
38
|
+
### Usage
|
|
76
39
|
```
|
|
77
|
-
|
|
78
|
-
### Step 3: Monitor and Rollback
|
|
79
|
-
```typescript
|
|
80
|
-
// Automatic rollback on issues
|
|
81
|
-
if (result.rolledBack) {
|
|
82
|
-
console.log('Deployment rolled back due to issues');
|
|
83
|
-
await canary.rollback(target);
|
|
84
|
-
}
|
|
40
|
+
/ci [run-id]
|
|
85
41
|
```
|
|
86
42
|
|
|
87
|
-
|
|
43
|
+
Shows:
|
|
44
|
+
- Current/last CI run status
|
|
45
|
+
- Exit codes
|
|
46
|
+
- Duration
|
|
47
|
+
- Events
|
|
88
48
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
49
|
+
### Exit Codes
|
|
50
|
+
| Code | Meaning |
|
|
51
|
+
|------|---------|
|
|
52
|
+
| 0 | Success |
|
|
53
|
+
| 1 | General failure |
|
|
54
|
+
| 2 | Misuse/Invalid input |
|
|
55
|
+
| 3 | Configuration error |
|
|
56
|
+
| 124 | Timeout |
|
|
57
|
+
| 137 | SIGKILL (OOM) |
|
|
95
58
|
|
|
96
|
-
|
|
59
|
+
## Deployment Strategies
|
|
97
60
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
61
|
+
### Canary Deployment
|
|
62
|
+
1. Deploy to small percentage
|
|
63
|
+
2. Monitor metrics
|
|
64
|
+
3. Gradually increase
|
|
65
|
+
4. Full rollout or rollback
|
|
103
66
|
|
|
104
|
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
67
|
+
### Landing Queue
|
|
68
|
+
- Queue changes for controlled rollout
|
|
69
|
+
- Automatic promotion
|
|
70
|
+
- Manual gates for risky changes
|
|
107
71
|
|
|
108
|
-
##
|
|
72
|
+
## Pipeline Monitoring
|
|
109
73
|
|
|
110
|
-
###
|
|
111
|
-
```typescript
|
|
112
|
-
queue.enqueue('v1.2.0', 'production', 'Feature release');
|
|
74
|
+
### Status Check
|
|
113
75
|
```
|
|
114
|
-
|
|
115
|
-
### Process Queue
|
|
116
|
-
```typescript
|
|
117
|
-
while (const next = queue.startNext()) {
|
|
118
|
-
await deploy(next);
|
|
119
|
-
queue.complete(next.id, success);
|
|
120
|
-
}
|
|
76
|
+
/ci
|
|
121
77
|
```
|
|
122
78
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
79
|
+
Returns:
|
|
80
|
+
- Run ID
|
|
81
|
+
- Start time
|
|
82
|
+
- Events (pass/fail)
|
|
83
|
+
- Exit code
|
|
84
|
+
- Duration
|
|
85
|
+
|
|
86
|
+
### Historical Analysis
|
|
87
|
+
Track patterns in:
|
|
88
|
+
- Build times
|
|
89
|
+
- Failure rates
|
|
90
|
+
- Flaky tests
|
|
127
91
|
|
|
128
92
|
## Examples
|
|
129
93
|
|
|
130
|
-
###
|
|
94
|
+
### Check CI Status
|
|
131
95
|
```
|
|
132
|
-
User:
|
|
96
|
+
User: What's the CI status?
|
|
133
97
|
Agent:
|
|
134
|
-
|
|
135
|
-
if (result.success) {
|
|
136
|
-
console.log('Deployment successful!');
|
|
137
|
-
} else {
|
|
138
|
-
console.log('Rolled back - check issues');
|
|
139
|
-
}
|
|
98
|
+
/ci
|
|
140
99
|
```
|
|
141
100
|
|
|
142
|
-
###
|
|
101
|
+
### Check Specific Run
|
|
143
102
|
```
|
|
144
|
-
User: Queue these deployments: v1.2.0, v1.2.1, v1.2.2
|
|
145
103
|
Agent:
|
|
146
|
-
|
|
147
|
-
queue.enqueue('v1.2.1', 'production');
|
|
148
|
-
queue.enqueue('v1.2.2', 'staging');
|
|
149
|
-
|
|
150
|
-
const result = await queue.processAll();
|
|
104
|
+
/ci run-123
|
|
151
105
|
```
|
|
152
106
|
|
|
153
|
-
###
|
|
107
|
+
### Analyze Failure
|
|
154
108
|
```
|
|
155
|
-
User:
|
|
109
|
+
User: Why did the build fail?
|
|
156
110
|
Agent:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
## Output Format
|
|
161
|
-
|
|
162
|
-
### Canary Report
|
|
163
|
-
```markdown
|
|
164
|
-
## Canary Deployment Report
|
|
165
|
-
**Status:** ✅ SUCCESS
|
|
166
|
-
**Final Traffic:** 100%
|
|
167
|
-
**Rolled Back:** No
|
|
168
|
-
|
|
169
|
-
### Metrics History
|
|
170
|
-
| Time | Success | Latency | Error Rate |
|
|
171
|
-
|------|---------|---------|------------|
|
|
172
|
-
| 0min | 98.5% | 120ms | 1.2% |
|
|
173
|
-
| 1min | 99.1% | 115ms | 0.8% |
|
|
174
|
-
| 2min | 99.3% | 110ms | 0.5% |
|
|
111
|
+
/ci
|
|
112
|
+
# Analyze events and exit code
|
|
175
113
|
```
|
|
176
114
|
|
|
177
|
-
###
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
|
|
115
|
+
### Run Deployment
|
|
116
|
+
```bash
|
|
117
|
+
# Deploy with canary
|
|
118
|
+
./scripts/deploy.sh --strategy=canary --initial=5%
|
|
181
119
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
Status: deploying
|
|
185
|
-
|
|
186
|
-
### Queue
|
|
187
|
-
| # | Version | Environment | Message |
|
|
188
|
-
|---|--------|------------|---------|
|
|
189
|
-
| 1 | v1.2.2 | production | Hotfix |
|
|
190
|
-
| 2 | v1.2.3 | staging | New feature |
|
|
120
|
+
# Check deployment status
|
|
121
|
+
/ci
|
|
191
122
|
```
|
|
192
123
|
|
|
193
|
-
##
|
|
124
|
+
## Configuration
|
|
194
125
|
|
|
195
|
-
###
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
### With pi-audit
|
|
210
|
-
```typescript
|
|
211
|
-
// Security scan before deploy
|
|
212
|
-
const shield = new AgentShield();
|
|
213
|
-
const scan = shield.scan(deploymentCode);
|
|
214
|
-
|
|
215
|
-
if (!scan.passed) {
|
|
216
|
-
console.log('Security issues must be fixed');
|
|
217
|
-
process.exit(1);
|
|
218
|
-
}
|
|
126
|
+
### Pipeline Config
|
|
127
|
+
```yaml
|
|
128
|
+
ci:
|
|
129
|
+
timeout: 300
|
|
130
|
+
retry: 2
|
|
131
|
+
parallel: true
|
|
132
|
+
|
|
133
|
+
deploy:
|
|
134
|
+
strategy: canary
|
|
135
|
+
canary:
|
|
136
|
+
initial: 5%
|
|
137
|
+
increment: 10%
|
|
138
|
+
pause: 5m
|
|
219
139
|
```
|
|
220
140
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
'deployment',
|
|
226
|
-
`Deployed ${version} to ${environment}`,
|
|
227
|
-
'observation'
|
|
228
|
-
);
|
|
229
|
-
```
|
|
141
|
+
## Integration
|
|
142
|
+
- With pi-pipeline for verification gates
|
|
143
|
+
- With pi-debug for error investigation
|
|
144
|
+
- With pi-render for status display
|