Skip to content

Commit 6a964a4

Browse files
Merge pull request #38 from michaeldeongreen/test
Promote bulk gap-bridging + cleanup + workspace_swap hardening to main
2 parents 68db375 + 2137364 commit 6a964a4

18 files changed

Lines changed: 2278 additions & 219 deletions

.github/prompts/swap-to-feature.prompt.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
description: Swap the repo's IDs to your feature workspace and create the value set for the current branch.
33
mode: agent
44
---
5-
Run `python scripts/workspace_swap.py` from the repo root and report the output to me. The script will rewrite tracked Fabric files (semantic model, notebooks) so they point at your feature workspace instead of dev, create a feature value set, and update settings.json. It reads the feature workspace and lakehouse GUIDs from `.env` at the repo root — if `.env` is missing or empty, it will fall back to an interactive prompt.
5+
The script `scripts/workspace_swap.py` rewrites tracked Fabric files (semantic model, notebooks) so they point at your feature workspace instead of dev, creates a feature value set, and updates settings.json. It reads `FEATURE_WORKSPACE_ID` and `FEATURE_LAKEHOUSE_ID` from `.env` at the repo root and asks for a `YES` confirmation before applying. When invoked through this prompt, that confirmation must happen here in chat — never in the terminal — to avoid live-prompt handling problems.
66

7-
After the script finishes, summarize what changed and remind me to commit and push the changes, then sync the workspace from the Fabric UI.
7+
Follow this exact sequence:
8+
9+
1. Read `.env` at the repo root and read the dev workspace + lakehouse IDs from `data/fabric/Patterns_Variables.VariableLibrary/variables.json`.
10+
2. Show me the planned swap in chat (current branch, dev → feature workspace ID, dev → feature lakehouse ID).
11+
3. Use the chat UI to ask me a single question with two options: `YES` and `NO` (uppercase, exact). Do not proceed until I answer.
12+
4. If I answer `YES`, run `echo "YES" | python scripts/workspace_swap.py`. The piped `YES` satisfies the script's confirmation gate non-interactively, so the terminal never blocks. Report the full output.
13+
5. If I answer `NO`, do nothing further and confirm in chat that the swap was not applied.
14+
6. After a successful run only, summarize what changed and remind me to commit and push the changes, then sync the workspace from the Fabric UI.
15+
16+
Do not run the script directly without piping `YES` (it will block on the terminal prompt). Do not skip the chat confirmation — the in-script confirmation is bypassed by the pipe and the chat dialog is the gate.

.github/workflows/deploy-prod.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ permissions:
2121
contents: read
2222

2323
jobs:
24-
deploy-supported:
25-
name: Deploy supported items
24+
deploy-fabric-cicd:
25+
name: Deploy via fabric-cicd
2626
# Gated by the DEPLOY_METHOD repository variable. Runs when unset or set to
2727
# 'fabric-cicd'. Set DEPLOY_METHOD='bulk' to route deployments through
2828
# deploy-prod-bulk.yml instead. Any other value disables both workflows.
2929
if: vars.DEPLOY_METHOD == '' || vars.DEPLOY_METHOD == 'fabric-cicd'
30-
uses: ./.github/workflows/reusable-deploy-supported.yml
30+
uses: ./.github/workflows/reusable-deploy-fabric-cicd.yml
3131
with:
3232
environment: Prod
3333
item_type_in_scope: '["Lakehouse", "Ontology", "VariableLibrary", "Notebook", "SemanticModel", "Report", "DataAgent"]'

.github/workflows/deploy-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ permissions:
1818
contents: read
1919

2020
jobs:
21-
deploy-supported:
22-
name: Deploy supported items
21+
deploy-fabric-cicd:
22+
name: Deploy via fabric-cicd
2323
# Gated by the DEPLOY_METHOD repository variable. Runs when unset or set to
2424
# 'fabric-cicd'. Set DEPLOY_METHOD='bulk' to route deployments through
2525
# deploy-test-bulk.yml instead. Any other value disables both workflows.
2626
if: vars.DEPLOY_METHOD == '' || vars.DEPLOY_METHOD == 'fabric-cicd'
27-
uses: ./.github/workflows/reusable-deploy-supported.yml
27+
uses: ./.github/workflows/reusable-deploy-fabric-cicd.yml
2828
with:
2929
environment: Test
3030
item_type_in_scope: '["Lakehouse", "Ontology", "VariableLibrary", "Notebook", "SemanticModel", "Report", "DataAgent"]'

.github/workflows/reusable-deploy-bulk.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Reusable workflow: Deploy supported Fabric items via the Bulk Import Item Definitions API (Preview).
22
#
3-
# Alternative deployment path to reusable-deploy-supported.yml. Uses the Fabric
3+
# Alternative deployment path to reusable-deploy-fabric-cicd.yml. Uses the Fabric
44
# REST API's bulk import endpoint instead of the fabric-cicd Python library.
55
# Selected at orchestrator level via the DEPLOY_METHOD repository variable.
66
#
@@ -14,10 +14,19 @@
1414
# - Every item type in the request payload must support service principals
1515
# (the bulk API requires SPN support for ALL items in the request, not just some)
1616
#
17-
# Known gaps vs. reusable-deploy-supported.yml (fabric-cicd):
18-
# - No parameter.yml find_replace / key_value_replace substitution
19-
# - No orphan cleanup (Bulk Import API only supports Create/Update, not Delete)
20-
# - No item_type_in_scope filter (deploys everything in repository_directory)
17+
# Known gaps vs. reusable-deploy-fabric-cicd.yml (fabric-cicd):
18+
# The Bulk Import API itself has no parameterization, no value-set
19+
# activation, and no delete support. This repo bridges the first two in
20+
# scripts/deploy_bulk.py + data/fabric/bulk-parameter.yml. The remaining
21+
# gaps are intentionally not implemented:
22+
# - No full parameter.yml feature coverage. bulk-parameter.yml supports
23+
# find_replace + $items + $workspace + $environment placeholders only.
24+
# fabric-cicd's key_value_replace, spark_pool, semantic_model_binding
25+
# are not implemented here.
26+
# - No orphan cleanup. The Bulk Import API only supports Create/Update,
27+
# not Delete; deletes would need a separate per-item DELETE call loop.
28+
# - No item_type_in_scope filter. Deploys everything under
29+
# repository_directory.
2130
#
2231
# API references:
2332
# - Bulk import: https://learn.microsoft.com/en-us/rest/api/fabric/core/items/bulk-import-item-definitions(beta)
@@ -60,7 +69,7 @@ jobs:
6069
python-version: "3.12"
6170

6271
- name: Install dependencies
63-
run: pip install requests
72+
run: pip install requests PyYAML
6473

6574
- name: Bulk import item definitions
6675
env:
@@ -69,4 +78,5 @@ jobs:
6978
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
7079
FABRIC_WORKSPACE_ID: ${{ secrets.FABRIC_WORKSPACE_ID }}
7180
REPOSITORY_DIRECTORY: ${{ inputs.repository_directory }}
81+
ENVIRONMENT: ${{ inputs.environment }}
7282
run: python scripts/deploy_bulk.py

.github/workflows/reusable-deploy-supported.yml renamed to .github/workflows/reusable-deploy-fabric-cicd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# - Fabric Admin must enable "Service principals can use Fabric APIs"
1414
# - parameter.yml in repository_directory for environment-specific replacements
1515

16-
name: "Reusable: Deploy Supported Items"
16+
name: "Reusable: Deploy via fabric-cicd"
1717

1818
on:
1919
workflow_call:
@@ -38,7 +38,7 @@ permissions:
3838

3939
jobs:
4040
deploy:
41-
name: Deploy supported items (${{ inputs.environment }})
41+
name: Deploy via fabric-cicd (${{ inputs.environment }})
4242
runs-on: ubuntu-latest
4343
timeout-minutes: 30
4444
environment: ${{ inputs.environment }}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ Branch protection (PR required, source-branch restrictions, status checks) is en
5757
| Document | Description |
5858
|---|---|
5959
| [CI/CD Release Options](fabric-cicd-release-options.md) | Evaluates all CI/CD release options for Fabric (Deployment Pipelines, Git-based, Build-based, Hybrid) and recommends the Hybrid approach. Includes a [comparison of fabric-cicd vs the new Bulk Import / Export APIs](fabric-cicd-release-options.md#tooling-within-option-3-fabric-cicd-vs-bulk-apis) (Preview) within Option 3. **Start here** if you're deciding on a strategy. |
60-
| [Hybrid CI/CD Implementation Guide](fabric-hybrid-cicd-guide.md) | Deep dive into the implementation: workflow structure, configuration strategy, prerequisites, setup steps, and gotchas. |
60+
| [Hybrid CI/CD Implementation Guide](fabric-hybrid-cicd-guide.md) | Deep dive into the recommended fabric-cicd implementation: workflow structure, configuration strategy, prerequisites, setup steps, and gotchas. |
61+
| [Bulk CI/CD Implementation Guide](fabric-bulk-cicd-guide.md) | Implementation guide for the alternative Bulk Import API (Preview) deploy path. Covers the gap-bridging workarounds (substitution, value-set activation), the two-deploy decision, extension patterns, and limitations not bridged. |
6162
| [Development Process](fabric-development-process.md) | How developers work day-to-day: branch-out workflow, the workspace swap script, and PR readiness check. |
6263
| [CI/CD Governance Considerations](fabric-cicd-governance-considerations.md) | Considerations on identities, RBAC, branch protection, and approval gates for the CI/CD pipeline. Includes pointers to adjacent controls owned outside the pipeline (security/compliance topics). |
6364

data/fabric/bulk-parameter.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Bulk-deploy substitution rules and post-deploy configuration.
2+
#
3+
# This file is read by scripts/deploy_bulk.py to bridge the gaps between the
4+
# Bulk Import API and what fabric-cicd handles automatically:
5+
# - find/replace substitutions (no parameter.yml equivalent in bulk API)
6+
# - VariableLibrary active value-set selection (no bulk API equivalent)
7+
#
8+
# Format is intentionally distinct from fabric-cicd's parameter.yml — bulk
9+
# does not (and should not) implement parameter.yml's full DSL. The two
10+
# config files coexist in this directory: parameter.yml for fabric-cicd,
11+
# bulk-parameter.yml for bulk. Both are excluded from the bulk request
12+
# payload by deploy_bulk.py.
13+
#
14+
# Dynamic placeholders (resolved at deploy time):
15+
# $workspace.$id target workspace ID
16+
# $items.<Type>.<Name>.$id ID of an item deployed in phase 1
17+
# $environment value of the ENVIRONMENT env var (Test/Prod)
18+
19+
substitutions:
20+
# Replace dev lakehouse ID in items that reference it.
21+
- find: "c185283c-9dd9-4e40-a17c-aa6303e3a2e9"
22+
replace_with: "$items.Lakehouse.PatternsLakehouse.$id"
23+
item_types: [VariableLibrary, SemanticModel, Notebook]
24+
25+
# Replace dev workspace ID in items that reference it.
26+
- find: "d7270f11-feba-4990-baa6-d45e47f23737"
27+
replace_with: "$workspace.$id"
28+
item_types: [SemanticModel, Notebook]
29+
30+
variable_library:
31+
# Active value-set name to set on the deployed VariableLibrary.
32+
# Resolved at deploy time. Set to null to skip activation.
33+
active_value_set: "$environment"

0 commit comments

Comments
 (0)