|
1 | | -# Project Guidelines |
2 | | - |
3 | | -## Overview |
4 | | - |
5 | | -Reference implementation for CI/CD in Microsoft Fabric. Demonstrates version control, deployment, and environment-specific configuration for Fabric workspace items using GitHub Actions and [fabric-cicd](https://microsoft.github.io/fabric-cicd). |
6 | | - |
7 | | -## Project Layout |
8 | | - |
9 | | -``` |
10 | | -scripts/ Python CLI scripts (stdlib-only, Python 3.10+) |
11 | | -tests/ pytest unit tests |
12 | | -data/fabric/ Fabric item definitions (git-synced from Fabric workspaces) |
13 | | -.github/workflows/ GitHub Actions CI/CD pipelines |
14 | | -.github/instructions/ Path-specific Copilot instructions (Python, Actions) |
15 | | -``` |
16 | | - |
17 | | -## Build and Test |
18 | | - |
19 | | -```bash |
20 | | -pip install -r requirements-dev.txt |
21 | | -python -m pytest tests/ -v |
22 | | -``` |
23 | | - |
24 | | -No build step — scripts are standalone CLI tools, not an installable package. `pyproject.toml` configures pytest only (`pythonpath = ["scripts"]`). |
25 | | - |
26 | | -## Key Scripts |
27 | | - |
28 | | -- `scripts/branch_env.py` — Manages feature branch workspace bindings (bootstrap, reset, validate). Uses an **item type registry** pattern — new Fabric item types are added as config entries, not new functions. |
29 | | -- `scripts/branch_env.py --validate` — CI check for PR readiness (dev IDs present, no stray value sets). |
30 | | - |
31 | | -## Fabric Item Types |
32 | | - |
33 | | -Items fall into two categories based on how they reference environment resources: |
34 | | - |
35 | | -- **Actual IDs** (SemanticModel, Notebook): Embed real workspace/lakehouse GUIDs. Must be rewritten by `branch_env.py` for feature branches and reverted before PR. |
36 | | -- **Logical IDs** (Ontology, DataAgent): Reference items via `.platform` `logicalId`, resolved by Fabric at runtime. Portable across Branch Out workspaces — no rewriting needed. |
37 | | - |
38 | | -## CI/CD Configuration |
39 | | - |
40 | | -- `data/fabric/parameter.yml` — Deploy-time `find_replace` rules for fabric-cicd. Maps dev IDs to dynamic placeholders (`$workspace.$id`, `$items.Lakehouse.*.$id`). |
41 | | -- `data/fabric/Patterns_Variables.VariableLibrary/` — Runtime configuration via value sets (Test, Prod, feature branches). |
42 | | - |
43 | | -## Conventions |
44 | | - |
45 | | -- Path-specific instructions in `.github/instructions/` govern Python and Actions code style — follow them. |
46 | | -- Never commit notebook META blocks containing internal metadata (security). |
47 | | -- Validate GUIDs from external sources before using them. |
48 | | -- Pin GitHub Actions to commit SHAs, not version tags. |
49 | | -- All file I/O must specify `encoding="utf-8"`. |
50 | | - |
51 | | -## Workflows |
52 | | - |
53 | | -| Workflow | Trigger | Purpose | |
54 | | -|----------|---------|---------| |
55 | | -| `validate-branch-env.yml` | PR to `dev` | Blocks merge if dev IDs not restored | |
56 | | -| `run-tests.yml` | PR (any branch) | Runs pytest when scripts/tests change | |
57 | | - |
58 | | -## Documentation |
59 | | - |
60 | | -See `fabric-development-process.md` for the Branch Out workflow, item type reference table, and step-by-step bootstrap/reset guides. See `fabric-hybrid-cicd-guide.md` for the deployment architecture. |
| 1 | +# Project Guidelines |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Reference implementation for CI/CD in Microsoft Fabric. Demonstrates version control, deployment, and environment-specific configuration for Fabric workspace items using GitHub Actions and [fabric-cicd](https://microsoft.github.io/fabric-cicd). |
| 6 | + |
| 7 | +## Project Layout |
| 8 | + |
| 9 | +``` |
| 10 | +scripts/ Python CLI scripts (stdlib-only, Python 3.10+) |
| 11 | +tests/ pytest unit tests |
| 12 | +data/fabric/ Fabric item definitions (git-synced from Fabric workspaces) |
| 13 | +.github/workflows/ GitHub Actions CI/CD pipelines |
| 14 | +.github/instructions/ Path-specific Copilot instructions (Python, Actions) |
| 15 | +``` |
| 16 | + |
| 17 | +## Build and Test |
| 18 | + |
| 19 | +```bash |
| 20 | +pip install -r requirements-dev.txt |
| 21 | +python -m pytest tests/ -v |
| 22 | +``` |
| 23 | + |
| 24 | +No build step — scripts are standalone CLI tools, not an installable package. `pyproject.toml` configures pytest only (`pythonpath = ["scripts"]`). |
| 25 | + |
| 26 | +## Key Scripts |
| 27 | + |
| 28 | +- `scripts/workspace_swap.py` — Swaps Fabric workspace IDs in tracked files between dev and a feature workspace, and provides a CI readiness check (`--check-ready`). Uses an **item type registry** pattern — new Fabric item types are added as config entries, not new functions. |
| 29 | +- `scripts/workspace_swap.py --check-ready` — CI check for PR readiness (dev IDs present, no stray value sets). |
| 30 | + |
| 31 | +## Fabric Item Types |
| 32 | + |
| 33 | +Items fall into two categories based on how they reference environment resources: |
| 34 | + |
| 35 | +- **Actual IDs** (SemanticModel, Notebook): Embed real workspace/lakehouse GUIDs. Must be rewritten by `workspace_swap.py` for feature branches and reverted before PR. |
| 36 | +- **Logical IDs** (Ontology, DataAgent): Reference items via `.platform` `logicalId`, resolved by Fabric at runtime. Portable across Branch Out workspaces — no rewriting needed. |
| 37 | + |
| 38 | +## CI/CD Configuration |
| 39 | + |
| 40 | +- `data/fabric/parameter.yml` — Deploy-time `find_replace` rules for fabric-cicd. Maps dev IDs to dynamic placeholders (`$workspace.$id`, `$items.Lakehouse.*.$id`). |
| 41 | +- `data/fabric/Patterns_Variables.VariableLibrary/` — Runtime configuration via value sets (Test, Prod, feature branches). |
| 42 | + |
| 43 | +## Conventions |
| 44 | + |
| 45 | +- Path-specific instructions in `.github/instructions/` govern Python and Actions code style — follow them. |
| 46 | +- Never commit notebook META blocks containing internal metadata (security). |
| 47 | +- Validate GUIDs from external sources before using them. |
| 48 | +- Pin GitHub Actions to commit SHAs, not version tags. |
| 49 | +- All file I/O must specify `encoding="utf-8"`. |
| 50 | +- Local developer config goes in `.env` (gitignored). A committed `.env.sample` documents the expected keys. `scripts/workspace_swap.py` reads feature workspace IDs from `.env` when swapping to a feature workspace. |
| 51 | + |
| 52 | +## Workflows |
| 53 | + |
| 54 | +| Workflow | Trigger | Purpose | |
| 55 | +|----------|---------|---------| |
| 56 | +| `check-pr-ready.yml` | PR to `dev` | Blocks merge if dev IDs not restored | |
| 57 | +| `run-tests.yml` | PR (any branch) | Runs pytest when scripts/tests change | |
| 58 | + |
| 59 | +## Documentation |
| 60 | + |
| 61 | +See `fabric-development-process.md` for the Branch Out workflow, item type reference table, and step-by-step swap-to-feature / swap-to-dev guides. See `fabric-hybrid-cicd-guide.md` for the deployment architecture. |
0 commit comments