Skip to content

Commit b92db08

Browse files
authored
feat: migrate to plugin-ci-workflows (#1522)
* feat: migrate to plugin-ci-workflows * fix: remove unused files * fix: dangerjs check * fix: dangerjs to download bundle from old action * chore: add temporary push trigger for deployment testing * chore: test dev deployment * fix: remove testing triggers * fix: update slack channel for argo workflows * chore: update workflows documentation
1 parent 9273f46 commit b92db08

16 files changed

+353
-738
lines changed

.github/workflows.md

Lines changed: 120 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,120 @@
11
# Workflows
22

3+
> **Note**: This project uses shared workflows from [grafana/plugin-ci-workflows](https://github.com/grafana/plugin-ci-workflows) for standard CI/CD operations.
4+
> Documentation: https://enghub.grafana-ops.net/docs/default/component/grafana-plugins-platform/plugins-ci-github-actions/010-plugins-ci-github-actions
5+
36
## On creating a PR
47

8+
The `push.yml` workflow runs and performs:
9+
10+
**CI checks (via shared workflow):**
511
1. Setup plugin environment and cache
6-
2. Lint
12+
2. Lint (ESLint)
713
3. Integration and unit tests
8-
4. Check compatibility with latest Grafana API
9-
5. Build and typecheck
10-
6. Validate policy bot config
14+
4. Build and typecheck
15+
5. Compatibility check with latest Grafana API
1116

12-
## On creating a PR that targets main
17+
**SM-specific validations:**
18+
6. Auto-label PR
19+
7. Terraform configuration validation
20+
8. Probe API server mappings verification
21+
9. Grafana API compatibility check
22+
10. Policy bot validation
23+
11. Generate PR bundle size artifact
24+
12. DangerJS (bundle size comparison and PR checks)
1325

14-
... all of the above 7. Check bundle size changes (DangerJS)
26+
**Renovate PRs:**
27+
- Renovate reviewer runs automatically for PRs from renovate[bot]
1528

1629
## When pushing to main
1730

18-
1. Publish TechDocs (if docs changed)
19-
2. Release Please (manages releases and changelog)
20-
3. Generate main bundle size artifact
21-
4. **Deploy to dev** (automatic):
31+
The `push.yml` workflow runs and performs:
32+
33+
**CI/CD (via shared workflow):**
34+
1. All CI checks (lint, test, build, typecheck)
35+
2. **Deploy to dev** (automatic):
2236
- Build, sign, and zip plugin
2337
- Upload to GCS dev bucket (`grafanalabs-synthetic-monitoring-app-dev`)
2438
- Publish to dev catalog (grafana-dev.com)
25-
- Create deployment_tools PR (waits for catalog publishing to succeed)
26-
- Updates dev environment in hosted Grafana
39+
- Create Argo CD workflow
40+
- Auto-merge deployment PR for dev environment
41+
- Post notification to `#sm-ops-deploys` Slack channel
42+
43+
**Additional main-branch jobs:**
44+
3. Publish TechDocs to Backstage (if docs changed)
45+
4. Release Please (manages releases and changelog)
46+
5. Generate main bundle size artifact (for PR comparisons)
47+
6. All SM-specific validations (same as PRs)
2748

2849
## Manual Deployments
2950

30-
All manual deployments are triggered via GitHub Actions (`dispatch_deploy-plugin.yml`) with the following configuration options:
51+
Manual deployments are triggered via GitHub Actions (`publish.yml` workflow) with the following configuration options:
3152

3253
**Configuration Options:**
3354

34-
- `plugin_version`: The version of the plugin to deploy (required, default: 'latest')
35-
- `environment`: Deployment environment - 'dev', 'staging', or 'production' (required, default: 'dev')
36-
- `autoMerge`: Whether to automatically merge the deployment PR (optional, default: 'false')
55+
- `branch`: Branch to deploy from (default: 'main', can be used to deploy PRs to dev)
56+
- `environment`: Deployment environment - 'dev', 'ops', or 'prod' (required)
57+
- `docs-only`: Only publish docs, skip plugin deployment (optional, default: false)
3758

3859
### Deploy to dev (manual)
3960

40-
Manually triggered via GitHub Actions (`dispatch_deploy-plugin.yml`)
41-
Configuration: `environment: 'dev'`, `autoMerge: 'true'` (recommended)
61+
Manually triggered via GitHub Actions (`publish.yml`)
62+
63+
**Configuration:**
64+
- `branch`: main (or PR branch for testing)
65+
- `environment`: dev
66+
- `docs-only`: false
4267

68+
**Process:**
4369
1. Build, sign, and zip plugin
4470
2. Upload to GCS dev bucket (`grafanalabs-synthetic-monitoring-app-dev`)
4571
3. Publish to dev catalog (grafana-dev.com)
46-
4. Create deployment_tools PR (waits for catalog publishing to succeed)
72+
4. Create Argo CD workflow
73+
5. Auto-merge deployment PR (dev has auto-merge enabled)
74+
6. Post notification to `#sm-ops-deploys`
4775

48-
### Deploy to staging
76+
### Deploy to ops (staging)
4977

50-
Manually triggered via GitHub Actions (`dispatch_deploy-plugin.yml`)
51-
Configuration: `environment: 'staging'`, `autoMerge: 'true'` (recommended)
78+
Manually triggered via GitHub Actions (`publish.yml`)
5279

80+
**Configuration:**
81+
- `branch`: main
82+
- `environment`: ops
83+
- `docs-only`: false
84+
85+
**Process:**
5386
1. Build, sign, and zip plugin
5487
2. Upload to GCS prod bucket (`grafanalabs-synthetic-monitoring-app-prod`)
5588
3. Publish to ops catalog (grafana-ops.com)
56-
4. Create deployment_tools PR (waits for catalog publishing to succeed)
89+
4. Create Argo CD workflow
90+
5. Manual merge required for deployment PR
91+
6. Post notification to `#sm-ops-deploys`
5792

5893
### Deploy to prod
5994

60-
Manually triggered via GitHub Actions (`dispatch_deploy-plugin.yml`)
61-
Configuration: `environment: 'production'`, `autoMerge: 'true'` (recommended)
95+
Manually triggered via GitHub Actions (`publish.yml`)
96+
97+
**Configuration:**
98+
- `branch`: main
99+
- `environment`: prod
100+
- `docs-only`: false
62101

102+
**Process:**
63103
1. Build, sign, and zip plugin
64104
2. Upload to GCS prod bucket (`grafanalabs-synthetic-monitoring-app-prod`)
65105
3. Publish to prod catalog (grafana.com)
66-
4. Create deployment_tools PR (waits for catalog publishing to succeed)
106+
4. Create Argo CD workflow
107+
5. Manual merge required for deployment PR
108+
6. Post notification to `#sm-ops-deploys`
67109

68-
### Manual Release Please
110+
### Docs-only deployment
69111

70-
Can be manually triggered via GitHub Actions to force a release-please run outside of the normal main branch commits.
112+
You can deploy only documentation updates without rebuilding/redeploying the plugin:
113+
114+
**Configuration:**
115+
- `branch`: main (or docs branch)
116+
- `environment`: dev/ops/prod
117+
- `docs-only`: true
71118

72119
## Release Process
73120

@@ -79,37 +126,58 @@ Can be manually triggered via GitHub Actions to force a release-please run outsi
79126

80127
## Workflow Structure
81128

82-
The GitHub Actions setup uses reusable workflows organized into these categories:
129+
The GitHub Actions setup uses a combination of:
130+
- **Shared workflows** from `grafana/plugin-ci-workflows` (standard CI/CD operations)
131+
- **Local reusable workflows** for SM-specific validations and processes
83132

84133
### Core Workflows (Entry Points)
85134

86-
- `on-pr-creation.yml` - **Triggered on PR creation** - Runs all PR validation checks
87-
- `on-push-to-main.yml` - **Triggered on main branch push** - Handles builds and auto-deployment
88-
- `dispatch_deploy-plugin.yml` - **Manual trigger** - Deployment to any environment
89-
90-
### Reusable Workflow Components
91-
92-
**Build & Test:**
93-
94-
- `call_env-setup.yml` - Sets up plugin environment and caching
95-
- `call_lint.yml` - Runs ESLint checks
96-
- `call_integration-tests.yml` - Runs Jest integration and unit tests
97-
- `call_build-and-typecheck.yml` - Builds plugin and runs TypeScript checks
135+
- `push.yml` - **Triggered on PRs and main branch pushes** - Unified CI/CD workflow
136+
- For PRs: Runs CI checks only (lint, test, build, typecheck)
137+
- For main: Runs CI checks + deploys to dev environment automatically
138+
- `publish.yml` - **Manual trigger** - Deploy to any environment (dev/ops/prod)
139+
140+
### Shared Workflow
141+
142+
**`grafana/plugin-ci-workflows/.github/workflows/cd.yml@ci-cd-workflows/v4.3.0`**
143+
144+
This shared workflow handles all standard plugin CI/CD operations:
145+
- Environment setup and caching
146+
- Linting (ESLint)
147+
- Testing (Jest integration and unit tests)
148+
- Building and typechecking
149+
- Signing plugin
150+
- Uploading to GCS buckets
151+
- Publishing to Grafana catalogs
152+
- Creating Argo CD workflows
153+
- Deployment orchestration
154+
155+
**Configuration for SM App:**
156+
- `scopes: universal` - Supports both on-prem and cloud
157+
- `grafana-cloud-deployment-type: provisioned` - Plugin is auto-provisioned
158+
- `argo-workflow-slack-channel: #sm-ops-deploys` - Deployment notifications
159+
- `auto-merge-environments: dev` - Auto-merge deployment PRs for dev
160+
- `node-version: 22` - Node.js version
161+
- `run-playwright: false` - Skip Playwright e2e tests
162+
163+
### SM-Specific Reusable Workflows
164+
165+
**Validation & Quality:**
166+
167+
- `call_auto-label.yml` - Auto-labels PRs based on changed files
168+
- `call_validate-terraform.yml` - Validates generated Terraform configurations
169+
- `call_verify-probe-api-server-mappings.yml` - Verifies probe API server mappings
98170
- `call_grafana-compat.yml` - Checks compatibility with latest Grafana API
99-
100-
**Quality & Analysis:**
101-
102-
- `call_dangerJS.yml` - Runs bundle size comparison and PR checks
103-
- `call_main-bundle-size.yml` - Generates bundle size artifacts for comparison
104171
- `call_validate-policy-bot.yml` - Validates policy bot configuration
172+
- `call_dangerJS.yml` - Runs bundle size comparison and PR checks
173+
- `call_pr-bundle-size.yml` - Generates bundle size artifacts for PR comparison
174+
- `call_main-bundle-size.yml` - Generates bundle size artifacts for main branch
105175

106-
**Deployment & Release:**
176+
**Release & Documentation:**
107177

108-
- `call_build-sign-upload-plugin.yml` - Builds, signs, and uploads plugin to GCS
109-
- `call_deploy-plugin.yml` - Orchestrates deployment process with environment-specific jobs
110-
- `call_update-deployment-tools.yml` - Creates deployment_tools PRs
111178
- `call_release-please.yml` - Handles release management (auto + manual)
179+
- `call_publish-techdocs.yml` - Publishes documentation to Backstage
112180

113-
**Documentation:**
181+
**Renovate Automation:**
114182

115-
- `call_publish-techdocs.yml` - Publishes documentation to Backstage
183+
- `call_renovate_reviewer.yml` - Auto-reviews and manages Renovate PRs

.github/workflows/call_build-sign-upload-plugin.yml

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)