Skip to content

Commit 801b078

Browse files
committed
Refactor OpEx dashboard deploy workflow to standardize config pattern; update documentation to reflect expected config file structure
1 parent 9d81c40 commit 801b078

File tree

2 files changed

+10
-46
lines changed

2 files changed

+10
-46
lines changed

.github/workflows/opex-dashboard-deploy.yaml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@ name: OpEx Dashboard Deploy
22

33
on:
44
workflow_call:
5-
inputs:
6-
config_pattern:
7-
description: |
8-
Glob pattern(s) to find dashboard config files. Supports multiple patterns (one per line).
9-
Examples:
10-
Single: 'infra/dashboards/**/config.yaml'
11-
Multiple: |
12-
infra/dashboards/**/config.yaml
13-
.opex/**/config.yaml
14-
type: string
15-
required: true
165

176
env:
187
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
@@ -114,7 +103,7 @@ jobs:
114103
id: generate-action
115104
uses: pagopa/dx/actions/opex-dashboard-generate@chores/opex-workflow
116105
with:
117-
config_pattern: ${{ inputs.config_pattern }}
106+
config_pattern: ".opex/**/config.yaml"
118107
opex_dashboard_version: ${{ env.OPEX_DASHBOARD_VERSION }}
119108
base_ref: ${{ steps.set-base-ref.outputs.base_ref }}
120109
package_manager: ${{ steps.node-setup.outputs.package-manager }}

apps/website/docs/pipelines/opex-dashboard.md

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ strategy.
2121
apply) with separate CI/CD environments
2222
- 🔒 **Secure by Default**: Uses Azure OIDC, GitHub environments, and encrypted
2323
plan artifacts
24-
- 🌍 **Flexible Structure**: Supports dashboard configs anywhere in your
25-
repository
24+
- 🌍 **Standard Structure**: Expects dashboard configs in `.opex/**/config.yaml`
25+
paths repository
2626

2727
## Architecture
2828

@@ -62,8 +62,6 @@ jobs:
6262
deploy:
6363
uses: pagopa/dx/.github/workflows/opex-dashboard-deploy.yaml@main
6464
secrets: inherit
65-
with:
66-
config_pattern: "infra/dashboards/**/config.yaml"
6765
```
6866
6967
### Example: Plan on Pull Requests
@@ -81,8 +79,6 @@ jobs:
8179
plan:
8280
uses: pagopa/dx/.github/workflows/opex-dashboard-deploy.yaml@main
8381
secrets: inherit
84-
with:
85-
config_pattern: "infra/dashboards/**/config.yaml"
8682
```
8783
8884
### Advanced Example: Multiple Environments with Private Agent
@@ -99,26 +95,13 @@ jobs:
9995
if: github.ref == 'refs/heads/develop'
10096
uses: pagopa/dx/.github/workflows/opex-dashboard-deploy.yaml@main
10197
secrets: inherit
102-
with:
103-
config_pattern: "infra/dashboards/dev/**/config.yaml"
104-
use_private_agent: true
10598

10699
deploy-prod:
107100
if: github.ref == 'refs/heads/main'
108101
uses: pagopa/dx/.github/workflows/opex-dashboard-deploy.yaml@main
109102
secrets: inherit
110-
with:
111-
config_pattern: "infra/dashboards/prod/**/config.yaml"
112-
use_private_agent: true
113103
```
114104
115-
## Workflow Inputs
116-
117-
| Input | Description | Required | Default |
118-
| ------------------- | ------------------------------------------------------------------------------------- | -------- | ------- |
119-
| `config_pattern` | Glob pattern to find dashboard config files (e.g., `infra/dashboards/**/config.yaml`) | Yes | - |
120-
| `use_private_agent` | Use a private agent to run Terraform operations | No | `false` |
121-
122105
## Workflow Outputs
123106
124107
The workflow doesn't expose outputs directly. Deployment status can be monitored
@@ -148,7 +131,7 @@ through:
148131
### 2. Detection Phase (in Action)
149132

150133
- Compares current HEAD against `base_ref` using `git diff`
151-
- Finds all config files matching `config_pattern` glob
134+
- Finds all config files matching `.opex/**/config.yaml` glob
152135
- For each config, checks if:
153136
- The config file itself changed
154137
- Referenced OpenAPI spec (via `oa3_spec` field) changed
@@ -218,7 +201,6 @@ Both absolute and relative paths are supported for `oa3_spec`.
218201
- `opex-{environment}-ci` for plan operations (read-only)
219202
- `opex-{environment}-cd` for apply operations (write access)
220203
- **Input Validation**:
221-
- `config_pattern` validated to prevent glob injection
222204
- Git references validated before use in commands
223205
- Event names validated to prevent injection
224206
- **Minimal Permissions**:
@@ -230,12 +212,11 @@ Both absolute and relative paths are supported for `oa3_spec`.
230212

231213
## Directory Structure
232214

233-
The workflow supports **any directory structure** - dashboard configs can be
234-
located anywhere in your repository. The only requirement is that each config
235-
directory should contain (or will receive):
215+
The workflow expects dashboard configs to be located in `.opex/**/config.yaml`
216+
paths. Each config directory should contain (or will receive):
236217

237218
```
238-
path/to/dashboard/
219+
.opex/path/to/dashboard/
239220
├── config.yaml # Dashboard configuration
240221
├── backend.tf # Terraform backend (auto-generated by opex-dashboard or manually created)
241222
├── opex.tf # Generated dashboard Terraform (auto-generated)
@@ -347,17 +328,13 @@ to the new reusable workflow.
347328
push:
348329
branches: [main]
349330
paths:
350-
- "**/config.yaml" # Adjust pattern to match your structure
331+
- ".opex/**/config.yaml"
351332
- "**/openapi.yaml"
352333

353334
jobs:
354335
deploy:
355336
uses: pagopa/dx/.github/workflows/opex-dashboard-deploy.yaml@main
356337
secrets: inherit
357-
with:
358-
config_pattern: "infra/dashboards/**/config.yaml" # Adjust to your structure
359-
# Optional:
360-
# use_private_agent: true
361338
```
362339
363340
5. **Add Plan Workflow for PRs (Optional)**
@@ -370,15 +347,13 @@ to the new reusable workflow.
370347
on:
371348
pull_request:
372349
paths:
373-
- "**/config.yaml"
350+
- ".opex/**/config.yaml"
374351
- "**/openapi.yaml"
375352
376353
jobs:
377354
plan:
378355
uses: pagopa/dx/.github/workflows/opex-dashboard-deploy.yaml@main
379356
secrets: inherit
380-
with:
381-
config_pattern: "infra/dashboards/**/config.yaml"
382357
```
383358

384359
6. **Test the Migration**
@@ -404,7 +379,7 @@ to the new reusable workflow.
404379

405380
**No dashboards detected:**
406381

407-
- Verify `config_pattern` matches your file structure
382+
- Verify config files are located in `.opex/**/config.yaml` paths
408383
- Check that OpenAPI specs or configs actually changed in the commit
409384
- Review automatic base reference detection in workflow logs (look for "Using
410385
base reference" message)

0 commit comments

Comments
 (0)