|
1 | | -# 🛠️ Multi-Environment Workflows – UTMStack |
| 1 | +# 🛠️ GitHub Actions Workflows – UTMStack |
2 | 2 |
|
3 | | -> This repository uses a structured, version-based deployment system (`v10`, `v11`) across multiple environments: `dev`, `qa`, `rc`, and `prod`. |
4 | | -> Each environment is triggered automatically based on branch patterns and workflow logic. |
| 3 | +> This repository uses streamlined CI/CD workflows for building and deploying UTMStack v10 and v11 across different environments. |
5 | 4 |
|
6 | | - |
| 5 | +## 📋 Table of Contents |
7 | 6 |
|
8 | | -## 🌿 Branches Involved |
9 | | - |
10 | | -- `v10`, `v11` → Main version branches |
11 | | -- `release/v10.x.x`, `release/v11.x.x` → Feature/bugfix integration branches |
12 | | -- `hotfix/v10.x.x`, `hotfix/v11.x.x` → For urgent production fixes |
13 | | -- `feature/...` → Optional; features are typically integrated into `release/*` branches |
| 7 | +- [Workflows Overview](#workflows-overview) |
| 8 | +- [V10 Deployment Pipeline](#v10-deployment-pipeline) |
| 9 | +- [V11 Deployment Pipeline](#v11-deployment-pipeline) |
| 10 | +- [Installer Release](#installer-release) |
| 11 | +- [Required Secrets and Variables](#required-secrets-and-variables) |
14 | 12 |
|
15 | 13 | --- |
16 | 14 |
|
17 | | -## ✨ Feature Flow (per version) |
| 15 | +## 🔄 Workflows Overview |
| 16 | + |
| 17 | +### 1. **installer-release.yml** |
| 18 | +Automatically builds and publishes installers when a GitHub release is created. |
| 19 | + |
| 20 | +**Trigger:** Release created (types: `released`) |
| 21 | + |
| 22 | +**Behavior:** |
| 23 | +- Detects version (v10 or v11) from release tag |
| 24 | +- Builds installer for the detected version |
| 25 | +- Uploads installer binary to the GitHub release |
18 | 26 |
|
19 | | -> Best used for planned feature development. |
| 27 | +### 2. **v10-deployment-pipeline.yml** |
| 28 | +Automated CI/CD pipeline for v10 builds and deployments. |
20 | 29 |
|
21 | | -1. Developers work on shared integration branches: |
22 | | - `release/v10.x.x` or `release/v11.x.x` |
| 30 | +**Triggers:** |
| 31 | +- Push to `v10` branch → Deploys to **v10-rc** |
| 32 | +- Push to `release/v10**` branches → Deploys to **v10-dev** |
| 33 | +- Tags `v10.*` → Production build |
23 | 34 |
|
24 | | -2. On **push**, the `dev` workflow is triggered and deployed to: |
25 | | - `v10-dev` or `v11-dev` |
| 35 | +**Environments:** |
| 36 | +- `v10-dev` - Development environment (from release branches) |
| 37 | +- `v10-rc` - Release candidate environment (from v10 branch) |
| 38 | +- Production (from tags) |
26 | 39 |
|
27 | | -3. Once stable, a **pull request is opened to `v10` or `v11`**, the `qa` workflow is triggered and deployed to: |
28 | | - `v10-qa` or `v11-qa` |
| 40 | +### 3. **v11-deployment-pipeline.yml** |
| 41 | +Manual deployment pipeline for v11 with version control. |
29 | 42 |
|
30 | | -5. After QA validation, the PR is **merged** into the base branch (`v10` or `v11`). |
| 43 | +**Trigger:** Manual (`workflow_dispatch`) |
31 | 44 |
|
32 | | -6. This triggers deployment to the **RC environment**: |
33 | | - `v10-rc` or `v11-rc` |
| 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`) |
34 | 48 |
|
35 | | -7. Once RC validation is complete, a **release tag (`v10.x.x` or `v11.x.x`)** is created to deploy to production. |
| 49 | +**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`) |
36 | 52 |
|
37 | 53 | --- |
38 | 54 |
|
39 | | -## 🔥 Hotfix Flow (urgent patches) |
| 55 | +## 🚀 V10 Deployment Pipeline |
40 | 56 |
|
41 | | -> Used for emergency fixes in production. |
| 57 | +### Flow |
42 | 58 |
|
43 | | -1. Create a branch: |
44 | | - `hotfix/v10.x.x` or `hotfix/v11.x.x` from `v10` or `v11` |
| 59 | +``` |
| 60 | +┌─────────────────────┐ |
| 61 | +│ Push to Branch │ |
| 62 | +└──────────┬──────────┘ |
| 63 | + │ |
| 64 | + ├─── release/v10** ──→ Build & Deploy to v10-dev |
| 65 | + ├─── v10 ──────────→ Build & Deploy to v10-rc |
| 66 | + └─── tag v10.* ────→ Build for Production |
| 67 | +``` |
45 | 68 |
|
46 | | -2. After development, open a **PR to `v10` or `v11`** |
| 69 | +### Jobs |
47 | 70 |
|
48 | | -3. On merge, the `rc` workflow is triggered: |
49 | | - `v10-rc` or `v11-rc` |
| 71 | +1. **setup_deployment** - Determines environment based on trigger |
| 72 | +2. **validations** - Validates user permissions |
| 73 | +3. **build_agent** - Builds and signs Windows/Linux agents |
| 74 | +4. **build_agent_manager** - Builds agent-manager Docker image |
| 75 | +5. **build_*** - Builds all microservices (aws, backend, correlation, frontend, etc.) |
| 76 | +6. **all_builds_complete** - Checkpoint for all builds |
| 77 | +7. **deploy_dev / deploy_rc** - Deploys to respective environments |
50 | 78 |
|
51 | | -4. If the patch is valid, create a **release tag** to deploy to production. |
| 79 | +### Permissions |
| 80 | + |
| 81 | +- **Dev deployments**: `integration-developers` or `core-developers` teams |
| 82 | +- **RC/Prod deployments**: Same as dev |
52 | 83 |
|
53 | 84 | --- |
54 | 85 |
|
55 | | -## ⚙️ GitHub Actions Triggers |
| 86 | +## 🎯 V11 Deployment Pipeline |
| 87 | + |
| 88 | +### Flow |
| 89 | + |
| 90 | +``` |
| 91 | +┌─────────────────────────────┐ |
| 92 | +│ Manual Workflow Dispatch │ |
| 93 | +│ with version_tag input │ |
| 94 | +└──────────────┬──────────────┘ |
| 95 | + │ |
| 96 | + ├─── v11.x.x-dev.N ──→ DEV Environment |
| 97 | + └─── v11.x.x ────────→ PROD Environment |
| 98 | +``` |
| 99 | + |
| 100 | +### Jobs |
| 101 | + |
| 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 |
| 114 | + |
| 115 | +### Permissions |
| 116 | + |
| 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 |
| 123 | + |
| 124 | +### Environment Detection |
| 125 | + |
| 126 | +The pipeline automatically detects the environment based on version format: |
| 127 | + |
| 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` | |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +## 📦 Installer Release |
| 136 | + |
| 137 | +### Flow |
| 138 | + |
| 139 | +``` |
| 140 | +┌─────────────────────┐ |
| 141 | +│ GitHub Release │ |
| 142 | +│ Created & Published│ |
| 143 | +└──────────┬──────────┘ |
| 144 | + │ |
| 145 | + ├─── Tag v10.x.x ──→ Build v10 Installer |
| 146 | + └─── Tag v11.x.x ──→ Build v11 Installer |
| 147 | +``` |
| 148 | + |
| 149 | +### Behavior |
| 150 | + |
| 151 | +- Validates release tag format |
| 152 | +- Builds installer with correct configuration: |
| 153 | + - **V10:** Basic build |
| 154 | + - **V11:** Build with ldflags (version, branch, encryption keys) |
| 155 | +- Uploads installer to GitHub release assets |
| 156 | + |
| 157 | +--- |
| 158 | + |
| 159 | +## 🔐 Required Secrets and Variables |
| 160 | + |
| 161 | +### Secrets |
| 162 | + |
| 163 | +| Secret Name | Used In | Description | |
| 164 | +|-------------|---------|-------------| |
| 165 | +| `API_SECRET` | All | GitHub API token for team membership validation | |
| 166 | +| `AGENT_SECRET_PREFIX` | v10, v11 | Agent encryption key | |
| 167 | +| `SIGN_CERT` | v10, v11 | Code signing certificate path (var) | |
| 168 | +| `SIGN_KEY` | v10, v11 | Code signing key | |
| 169 | +| `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) | |
| 172 | +| `CM_ENCRYPT_SALT` | installer | Encryption salt for installer | |
| 173 | +| `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) | |
| 176 | +| `GITHUB_TOKEN` | All | Auto-provided by GitHub Actions | |
56 | 177 |
|
57 | | -| Environment | Trigger Condition | |
58 | | -|-------------|-------------------| |
59 | | -| `dev` | Push to `release/v10**` or `release/v11**` | |
60 | | -| `qa` | Pull request to `v10` or `v11` from `release/v10**` or `release/v11**`, and approved | |
61 | | -| `rc` | Push to `v10` or `v11` from `hotfix/*` or `release/*` | |
62 | | -| `prod` | Push of a tag starting with `v10.` or `v11.` | |
| 178 | +### Variables |
| 179 | + |
| 180 | +| Variable Name | Used In | Description | Format | |
| 181 | +|---------------|---------|-------------|--------| |
| 182 | +| `SCHEDULE_INSTANCES_PROD` | v11 | Instance IDs for prod scheduling | Comma-separated UUIDs | |
| 183 | +| `SCHEDULE_INSTANCES_DEV` | v11 | Instance IDs for dev scheduling | Comma-separated UUIDs | |
| 184 | + |
| 185 | +**Example Variable Values:** |
| 186 | +``` |
| 187 | +SCHEDULE_INSTANCES_PROD=uuid1,uuid2,uuid3 |
| 188 | +SCHEDULE_INSTANCES_DEV=uuid-dev1 |
| 189 | +``` |
63 | 190 |
|
64 | 191 | --- |
65 | 192 |
|
66 | | -## 🚀 Releasing to Production |
| 193 | +## 🎮 How to Deploy |
67 | 194 |
|
68 | | -A production deployment is triggered only by pushing a version tag: |
| 195 | +### V10 Deployment |
| 196 | + |
| 197 | +**Dev Environment:** |
| 198 | +```bash |
| 199 | +git checkout release/v10.x.x |
| 200 | +git push origin release/v10.x.x |
| 201 | +# Automatically deploys to v10-dev |
| 202 | +``` |
69 | 203 |
|
| 204 | +**RC Environment:** |
| 205 | +```bash |
| 206 | +git checkout v10 |
| 207 | +git merge release/v10.x.x |
| 208 | +git push origin v10 |
| 209 | +# Automatically deploys to v10-rc |
| 210 | +``` |
| 211 | + |
| 212 | +**Production Release:** |
70 | 213 | ```bash |
71 | 214 | git tag v10.5.0 |
72 | | -git push origin v10.5.0 |
| 215 | +git push origin v10.5.0 |
| 216 | +# Builds production artifacts |
| 217 | +``` |
| 218 | + |
| 219 | +### V11 Deployment |
| 220 | + |
| 221 | +**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" |
| 229 | + |
| 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" |
| 238 | + |
| 239 | +--- |
| 240 | + |
| 241 | +## 🏗️ Reusable Workflows |
| 242 | + |
| 243 | +The following reusable workflows are called by the main pipelines: |
| 244 | + |
| 245 | +- `reusable-basic.yml` - Basic Docker builds |
| 246 | +- `reusable-golang.yml` - Golang microservice builds |
| 247 | +- `reusable-java.yml` - Java microservice builds |
| 248 | +- `reusable-node.yml` - Node.js/Frontend builds |
| 249 | + |
| 250 | +--- |
| 251 | + |
| 252 | +## 📝 Notes |
| 253 | + |
| 254 | +- All Docker images are pushed to `ghcr.io/utmstack/utmstack/*` |
| 255 | +- V11 uses `-community` suffix for all image tags |
| 256 | +- Agent signing requires `utmstack-signer` runner |
| 257 | +- Artifacts (agents, collector) have 1-day retention |
| 258 | +- Failed deployments will stop the pipeline and report errors |
| 259 | + |
| 260 | +--- |
| 261 | + |
| 262 | +## 🆘 Troubleshooting |
| 263 | + |
| 264 | +**Permission Denied:** |
| 265 | +- 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` |
| 268 | + |
| 269 | +**Build Failures:** |
| 270 | +- Check that all required secrets are configured |
| 271 | +- Verify runner availability (especially `utmstack-signer` for agent builds) |
| 272 | +- Review build logs for specific errors |
| 273 | + |
| 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`) |
| 277 | + |
| 278 | +--- |
| 279 | + |
| 280 | +**For questions or issues, please contact the DevOps team.** |
0 commit comments