Skip to content

Commit 872d62a

Browse files
committed
fix[ci/cd]: update cm auth secret name and update workflow procedures
1 parent ad2e220 commit 872d62a

File tree

2 files changed

+116
-66
lines changed

2 files changed

+116
-66
lines changed

.github/workflows/README.md

Lines changed: 111 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,15 @@ Automated CI/CD pipeline for v10 builds and deployments.
3838
- Production (from tags)
3939

4040
### 3. **v11-deployment-pipeline.yml**
41-
Manual deployment pipeline for v11 with version control.
41+
Automated CI/CD pipeline for v11 builds and deployments.
4242

43-
**Trigger:** Manual (`workflow_dispatch`)
44-
45-
**Required Inputs:**
46-
- `version_tag`: Version to deploy (e.g., `v11.0.0-dev.1` or `v11.1.0`)
47-
- `event_processor_tag`: Event processor version (e.g., `1.0.0-beta`)
43+
**Triggers:**
44+
- Push to `release/v11**` branches → Deploys to **dev** environment
45+
- Prerelease created → Deploys to **rc** environment
4846

4947
**Version Formats:**
50-
- **Dev:** `v11.x.x-dev.N` (e.g., `v11.0.0-dev.1`)
51-
- **Production:** `v11.x.x` (e.g., `v11.1.0`)
48+
- **Dev:** `v11.x.x-dev.N` (e.g., `v11.2.1-dev.1`) - Auto-incremented
49+
- **RC:** `v11.x.x` (e.g., `v11.2.1`) - From prerelease tag
5250

5351
---
5452

@@ -89,46 +87,84 @@ Manual deployment pipeline for v11 with version control.
8987

9088
```
9189
┌─────────────────────────────┐
92-
│ Manual Workflow Dispatch │
93-
│ with version_tag input │
90+
│ Push to release/v11.x.x │
91+
│ branch │
92+
└──────────────┬──────────────┘
93+
94+
95+
Auto-increment version
96+
(v11.x.x-dev.N)
97+
98+
99+
Build & Deploy to DEV
100+
101+
102+
Publish to CM Dev
103+
104+
105+
Schedule to Dev Instances
106+
107+
108+
┌─────────────────────────────┐
109+
│ Create Prerelease │
110+
│ (tag: v11.x.x) │
94111
└──────────────┬──────────────┘
95112
96-
├─── v11.x.x-dev.N ──→ DEV Environment
97-
└─── v11.x.x ────────→ PROD Environment
113+
114+
Build & Deploy to RC
115+
116+
117+
Generate Changelog (AI)
118+
119+
120+
Build & Upload Installer
121+
122+
123+
Publish to CM Prod
124+
125+
126+
Schedule to Prod Instances
98127
```
99128

100129
### Jobs
101130

102-
1. **validations** - Validates user permissions and version format
103-
2. **build_agent** - Builds and signs Windows/Linux agents
104-
3. **build_utmstack_collector** - Builds UTMStack Collector
105-
4. **build_agent_manager** - Builds agent-manager Docker image
106-
5. **build_event_processor** - Builds event processor with plugins
107-
6. **build_backend** - Builds backend microservice (Java 17)
108-
7. **build_frontend** - Builds frontend microservice
109-
8. **build_user_auditor** - Builds user-auditor microservice
110-
9. **build_web_pdf** - Builds web-pdf microservice
111-
10. **all_builds_complete** - Checkpoint for all builds
112-
11. **publish_new_version** - Publishes version to Customer Manager
113-
12. **schedule** - Schedules release to configured instances
131+
1. **setup_deployment** - Determines environment and version based on trigger
132+
2. **validations** - Validates user permissions (team membership)
133+
3. **build_agent** - Builds and signs Windows/Linux agents
134+
4. **build_utmstack_collector** - Builds UTMStack Collector
135+
5. **build_agent_manager** - Builds agent-manager Docker image
136+
6. **build_event_processor** - Builds event processor with plugins
137+
7. **build_backend** - Builds backend microservice (Java 17)
138+
8. **build_frontend** - Builds frontend microservice
139+
9. **build_user_auditor** - Builds user-auditor microservice
140+
10. **build_web_pdf** - Builds web-pdf microservice
141+
11. **all_builds_complete** - Checkpoint for all builds
142+
12. **generate_changelog** - Generates AI-powered changelog (RC only)
143+
13. **build_installer_rc** - Builds and uploads installer (RC only)
144+
14. **deploy_installer_dev** - Deploys installer (Dev only)
145+
15. **publish_new_version** - Publishes version to Customer Manager
146+
16. **schedule** - Schedules release to configured instances
114147

115148
### Permissions
116149

117-
- **Dev versions** (`v11.x.x-dev.N`):
118-
- Must run from `release/` or `feature/` branches
119-
- Requires: `administrators`, `integration-developers`, or `core-developers` team membership
120-
121-
- **Production versions** (`v11.x.x`):
122-
- Requires: `administrators` team membership only
150+
- Requires: `integration-developers` or `core-developers` team membership
123151

124152
### Environment Detection
125153

126-
The pipeline automatically detects the environment based on version format:
154+
The pipeline automatically detects the environment based on trigger:
155+
156+
| Trigger | Environment | CM URL | Service Account | Schedule Instances Var |
157+
|---------|-------------|--------|-----------------|------------------------|
158+
| Push to `release/v11**` | dev | `https://cm.dev.utmstack.com` | `CM_SERVICE_ACCOUNT_DEV` | `SCHEDULE_INSTANCES_DEV` |
159+
| Prerelease created | rc | `https://cm.utmstack.com` | `CM_SERVICE_ACCOUNT_PROD` | `SCHEDULE_INSTANCES_PROD` |
127160

128-
| Version Format | Environment | CM Auth Secret | CM URL | Schedule Instances Var | Schedule Token Secret |
129-
|----------------|-------------|----------------|--------|------------------------|----------------------|
130-
| `v11.x.x-dev.N` | dev | `CM_AUTH_DEV` | `https://cm.dev.utmstack.com` | `SCHEDULE_INSTANCES_DEV` | `CM_SCHEDULE_TOKEN_DEV` |
131-
| `v11.x.x` | prod | `CM_AUTH` | `https://cm.utmstack.com` | `SCHEDULE_INSTANCES_PROD` | `CM_SCHEDULE_TOKEN_PROD` |
161+
### Version Auto-Increment (Dev)
162+
163+
For dev deployments, the version is automatically calculated:
164+
1. Extracts base version from branch name (e.g., `release/v11.2.1``v11.2.1`)
165+
2. Queries CM for latest version
166+
3. If base versions match, increments dev number (e.g., `v11.2.1-dev.9``v11.2.1-dev.10`)
167+
4. If base versions differ, starts fresh (e.g., `v11.2.1-dev.1`)
132168

133169
---
134170

@@ -167,25 +203,28 @@ The pipeline automatically detects the environment based on version format:
167203
| `SIGN_CERT` | v10, v11 | Code signing certificate path (var) |
168204
| `SIGN_KEY` | v10, v11 | Code signing key |
169205
| `SIGN_CONTAINER` | v10, v11 | Code signing container name |
170-
| `CM_AUTH` | v11 | Customer Manager auth credentials (prod) |
171-
| `CM_AUTH_DEV` | v11 | Customer Manager auth credentials (dev) |
206+
| `CM_SERVICE_ACCOUNT_PROD` | v11 | Customer Manager service account credentials (prod/rc) - JSON format `{"id": "...", "key": "..."}` |
207+
| `CM_SERVICE_ACCOUNT_DEV` | v11 | Customer Manager service account credentials (dev) - JSON format `{"id": "...", "key": "..."}` |
172208
| `CM_ENCRYPT_SALT` | installer | Encryption salt for installer |
173209
| `CM_SIGN_PUBLIC_KEY` | installer | Public key for installer verification |
174-
| `CM_SCHEDULE_TOKEN_PROD` | v11 | Auth token for cm-version-publisher (prod) |
175-
| `CM_SCHEDULE_TOKEN_DEV` | v11 | Auth token for cm-version-publisher (dev) |
210+
| `OPENAI_API_KEY` | v11 | OpenAI API key for changelog generation |
176211
| `GITHUB_TOKEN` | All | Auto-provided by GitHub Actions |
177212

178213
### Variables
179214

180215
| Variable Name | Used In | Description | Format |
181216
|---------------|---------|-------------|--------|
182-
| `SCHEDULE_INSTANCES_PROD` | v11 | Instance IDs for prod scheduling | Comma-separated UUIDs |
217+
| `SCHEDULE_INSTANCES_PROD` | v11 | Instance IDs for prod/rc scheduling | Comma-separated UUIDs |
183218
| `SCHEDULE_INSTANCES_DEV` | v11 | Instance IDs for dev scheduling | Comma-separated UUIDs |
219+
| `TW_EVENT_PROCESSOR_VERSION_PROD` | v11 | ThreatWinds Event Processor version (prod/rc) | Semver (e.g., `1.0.0`) |
220+
| `TW_EVENT_PROCESSOR_VERSION_DEV` | v11 | ThreatWinds Event Processor version (dev) | Semver (e.g., `1.0.0-beta`) |
184221

185222
**Example Variable Values:**
186223
```
187224
SCHEDULE_INSTANCES_PROD=uuid1,uuid2,uuid3
188225
SCHEDULE_INSTANCES_DEV=uuid-dev1
226+
TW_EVENT_PROCESSOR_VERSION_PROD=1.0.0
227+
TW_EVENT_PROCESSOR_VERSION_DEV=1.0.0-beta
189228
```
190229

191230
---
@@ -219,22 +258,28 @@ git push origin v10.5.0
219258
### V11 Deployment
220259

221260
**Dev Environment:**
222-
1. Navigate to Actions tab
223-
2. Select "v11 - Build & Deploy Pipeline"
224-
3. Click "Run workflow"
225-
4. Fill in:
226-
- **version_tag:** `v11.0.0-dev.1`
227-
- **event_processor_tag:** `1.0.0-beta`
228-
5. Click "Run workflow"
261+
```bash
262+
git checkout release/v11.2.1
263+
# Make your changes
264+
git add .
265+
git commit -m "Your changes"
266+
git push origin release/v11.2.1
267+
# Automatically builds and deploys to dev
268+
# Version is auto-incremented (e.g., v11.2.1-dev.1, v11.2.1-dev.2, ...)
269+
```
229270

230-
**Production Release:**
231-
1. Navigate to Actions tab
232-
2. Select "v11 - Build & Deploy Pipeline"
233-
3. Click "Run workflow"
234-
4. Fill in:
235-
- **version_tag:** `v11.1.0`
236-
- **event_processor_tag:** `1.0.0`
237-
5. Click "Run workflow"
271+
**RC Release:**
272+
1. Navigate to GitHub Releases
273+
2. Click "Draft a new release"
274+
3. Create a new tag (e.g., `v11.2.1`)
275+
4. Select "Set as a pre-release"
276+
5. Click "Publish release"
277+
6. Pipeline automatically:
278+
- Builds all microservices
279+
- Generates AI-powered changelog
280+
- Builds and uploads installer
281+
- Publishes version to CM
282+
- Schedules updates to RC instances
238283

239284
---
240285

@@ -252,28 +297,33 @@ The following reusable workflows are called by the main pipelines:
252297
## 📝 Notes
253298

254299
- All Docker images are pushed to `ghcr.io/utmstack/utmstack/*`
255-
- V11 uses `-community` suffix for all image tags
256300
- Agent signing requires `utmstack-signer` runner
257301
- Artifacts (agents, collector) have 1-day retention
258302
- Failed deployments will stop the pipeline and report errors
303+
- Dev versions follow the format `v11.x.x-dev.N` (auto-incremented)
304+
- RC versions use the prerelease tag directly (e.g., `v11.2.1`)
259305

260306
---
261307

262308
## 🆘 Troubleshooting
263309

264310
**Permission Denied:**
265311
- Verify you're a member of the required team
266-
- For v11 prod: Must be in `administrators` team
267-
- For v11 dev: Can be in `administrators`, `integration-developers`, or `core-developers`
312+
- For v11: Must be in `integration-developers` or `core-developers` team
268313

269314
**Build Failures:**
270315
- Check that all required secrets are configured
271316
- Verify runner availability (especially `utmstack-signer` for agent builds)
272317
- Review build logs for specific errors
273318

274-
**Version Format Errors:**
275-
- Dev: Must match `v11.x.x-dev.N` (e.g., `v11.0.0-dev.1`)
276-
- Prod: Must match `v11.x.x` (e.g., `v11.1.0`)
319+
**Version Not Incrementing:**
320+
- Check that the CM API is accessible
321+
- Verify `CM_SERVICE_ACCOUNT_DEV` or `CM_SERVICE_ACCOUNT_PROD` secrets are correctly configured
322+
- Ensure the branch name follows the format `release/v11.x.x`
323+
324+
**Changelog Not Generated:**
325+
- Verify `OPENAI_API_KEY` secret is configured
326+
- Only applies to RC releases (prereleases)
277327

278328
---
279329

.github/workflows/v11-deployment-pipeline.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,11 @@ jobs:
448448
echo "CM URL: $CM_URL"
449449
echo "Tag: $TAG"
450450
451-
# Select CM_AUTH based on environment
451+
# Select CM_SERVICE_ACCOUNT based on environment
452452
if [ "$ENVIRONMENT" = "dev" ]; then
453-
cmAuth=$(echo '${{ secrets.CM_AUTH_DEV }}' | jq -r '.')
453+
cmAuth=$(echo '${{ secrets.CM_SERVICE_ACCOUNT_DEV }}' | jq -r '.')
454454
else
455-
cmAuth=$(echo '${{ secrets.CM_AUTH }}' | jq -r '.')
455+
cmAuth=$(echo '${{ secrets.CM_SERVICE_ACCOUNT_PROD }}' | jq -r '.')
456456
fi
457457
458458
id=$(echo "$cmAuth" | jq -r '.id')
@@ -491,11 +491,11 @@ jobs:
491491
# Select instance IDs and auth based on environment
492492
if [ "$ENVIRONMENT" = "dev" ]; then
493493
instance_ids="${{ vars.SCHEDULE_INSTANCES_DEV }}"
494-
auth_json='${{ secrets.CM_SCHEDULE_AUTH_DEV }}'
494+
auth_json='${{ secrets.CM_SERVICE_ACCOUNT_DEV }}'
495495
else
496496
# rc uses prod variables
497497
instance_ids="${{ vars.SCHEDULE_INSTANCES_PROD }}"
498-
auth_json='${{ secrets.CM_SCHEDULE_AUTH_PROD }}'
498+
auth_json='${{ secrets.CM_SERVICE_ACCOUNT_PROD }}'
499499
fi
500500
501501
# Extract id and key from auth JSON

0 commit comments

Comments
 (0)