agentleFS
MicrosoftKnown publishermicrosoft/fabric-cicd/.github/copilot-instructions.md

fabric-cicd

Copilot instructions333 starsChanged 7 months agoMITView on GitHub

fabric-cicd is a Python library for Microsoft Fabric CI/CD automation. It supports code-first Continuous Integration/Continuous Deployment automations to integrate Source Controlled workspaces into a deployment framework. Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here. Prerequisites: Requires Python 3.9+ Mandatory Validation (ALWAYS): Critical: NEVER cancel build/test commands. CI (.github/workflows/validate.yml) will fail if validation workflow incomplete. Must provide explicit token_credential parameter to FabricWorkspace. Alternative: deploy_with_config()…

  • Installs packages

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

20 rules. About 0 are common, 7 are distinctive, and 13 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 13

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does …

    line 5
  2. Distinctive:

    Import check → 2. Run tests → 3.

    line 24
  3. Very specific:

    Critical: NEVER cancel build/test commands.

    line 26
  4. Very specific:

    Must provide explicit token_credential parameter to FabricWorkspace.

    line 30
  5. Distinctive:

    Testing/imports: No authentication needed

    line 36
  6. Very specific:

    Only import from the top-level package (src/fabric_cicd/__init__.py).

    line 102
  7. Very specific:

    Adding constants: Add to ItemType enum + SERIAL_ITEM_PUBLISH_ORDER in src/fabric_cicd/constants.py

    line 149
  8. Very specific:

    Adding public exports: Update __all__ in src/fabric_cicd/__init__.py

    line 151
  9. Very specific:

    Test file naming: Follow the conventions in the tests/ directory.

    line 166
  10. Distinctive:

    Base branch: Always target main unless otherwise specified.

    line 187
  11. Distinctive:

    Use "Fixes" for bug fixes, "Closes" for features, "Resolves" for other changes

    line 191
  12. Distinctive:

    All PRs must be linked to valid GitHub issue

    line 200
  13. Very specific:

    Do not modify uv.lock manually — it is managed by uv

    line 204
  14. Very specific:

    Do not import from internal modules (e.g., fabric_cicd._items) — only use the public API from fabric_cicd

    line 205
  15. Very specific:

    Do not add print() statements — use the standard logging module

    line 206
  16. Distinctive:

    Do not create PRs without a linked GitHub issue

    line 207
  17. Very specific:

    Do not modify .github/workflows/ files unless explicitly required

    line 208
  18. Very specific:

    Import errors: Use uv run python prefix to ensure virtual environment

    line 214
  19. Very specific:

    Setup failures: Run uv sync --dev if modules missing

    line 216
  20. Very specific:

    Formatting issues: Run uv run ruff format to auto-fix most issues

    line 217

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Fabric CICD

fabric-cicd is a Python library for Microsoft Fabric CI/CD automation. It supports code-first Continuous Integration/Continuous Deployment automations to integrate Source Controlled workspaces into a deployment framework.

Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.

Quick Command Reference

Prerequisites: Requires Python 3.9+

TaskCommandTimeout
Setuppip install uv && uv sync --dev (NEVER CANCEL)120+s
Testuv run pytest -v (NEVER CANCEL)120+s
Import checkuv run python -c "from fabric_cicd import FabricWorkspace; print('Import successful')"30s
Formatuv run ruff format (Fix formatting issues)60s
Lint checkuv run ruff check (Check for linting issues)60s
Format checkuv run ruff format --check (Verify formatting is correct)60s
Docs builduv run mkdocs build --clean (Build documentation)60s
Docs serveuv run mkdocs serve (Start local documentation server)60s

Mandatory Validation (ALWAYS):

  1. Import check → 2. Run tests → 3. Format code → 4. Check linting → 5. Commit

Critical: NEVER cancel build/test commands. CI (.github/workflows/validate.yml) will fail if validation workflow incomplete.

Authentication

Must provide explicit token_credential parameter to FabricWorkspace.

Methods:

  • Local development: AzureCliCredential() or AzurePowerShellCredential()
  • CI/CD pipelines: ClientSecretCredential() with service principal
  • Testing/imports: No authentication needed

Example:

from azure.identity import AzureCliCredential
from fabric_cicd import FabricWorkspace

token_credential = AzureCliCredential()
workspace = FabricWorkspace(
    workspace_id="your-id",
    repository_directory="/path/to/workspace/items",
    token_credential=token_credential
)

Basic Usage

Programmatic API

from azure.identity import AzureCliCredential
from fabric_cicd import FabricWorkspace, publish_all_items, unpublish_all_orphan_items

token_credential = AzureCliCredential()
# Initialize workspace (supports either workspace_id OR workspace_name)
workspace = FabricWorkspace(
    workspace_id="your-workspace-id",  # Alternative: workspace_name="your-workspace-name"
    environment="DEV",
    repository_directory="/path/to/workspace/items",
    item_type_in_scope=["Notebook", "DataPipeline", "Environment"],
    token_credential=token_credential
)

# Deploy items
publish_all_items(workspace)

# Clean up orphaned items
unpublish_all_orphan_items(workspace)

Config-Based Deployment

Alternative: deploy_with_config() centralizes deployment settings in YAML.

from azure.identity import AzureCliCredential
from fabric_cicd import deploy_with_config
token_credential = AzureCliCredential()
result = deploy_with_config(
    config_file_path="config.yml",
    environment="dev",
    token_credential=token_credential
)

Implementation files:

  • Entry points: deploy_with_config(), publish_all_items(), unpublish_all_orphan_items() in src/fabric_cicd/publish.py
  • Config utilities: src/fabric_cicd/_common/_config_utils.py (loading, extraction)
  • Config validation: src/fabric_cicd/_common/_config_validator.py
  • Documentation: docs/how_to/config_deployment.md
  • Tests: tests/test_deploy_with_config.py, tests/test_config_validator.py

Public API Exports

Only import from the top-level package (src/fabric_cicd/__init__.py). Do not import internal modules directly.

Exported symbols:

  • FabricWorkspace - Main workspace management class
  • publish_all_items - Deploy all items in scope
  • unpublish_all_orphan_items - Remove orphaned items
  • deploy_with_config - Config-based deployment
  • DeploymentResult, DeploymentStatus - Deployment result types
  • ItemType - Enum of supported Fabric item types
  • FeatureFlag - Enum of feature flags
  • append_feature_flag - Add feature flags programmatically
  • change_log_level, configure_external_file_logging, disable_file_logging - Logging utilities

Project Structure

/
├── .github/workflows/    # CI/CD pipelines (test.yml, validate.yml, bump.yml)
├── docs/                # Documentation source files
├── docs/example/        # CI/CD scenario patterns (Azure DevOps, GitHub Actions, local development)
├── sample/              # Example workspace structure and items
├── src/fabric_cicd/     # Main library source code
├── tests/               # Test files
├── pyproject.toml       # Project configuration and dependencies
├── ruff.toml           # Code formatting and linting configuration
├── mkdocs.yml          # Documentation configuration
├── activate.ps1        # PowerShell setup script (Windows only)
└── uv.lock            # Dependency lock file

Development Guidelines

Core Concepts

  • Publisher Classes: Handle deployment logic for each Fabric item type in src/fabric_cicd/_items/
  • Serial Publishing: Items deploy in dependency order via SERIAL_ITEM_PUBLISH_ORDER
  • Parameterization: YAML-based environment-specific value replacement

Supported Item Types

Valid values for item_type_in_scope are defined in the ItemType enum in src/fabric_cicd/constants.py. Always reference that file for the current list — do not hard-code item type strings without verifying them against the enum.

The publish/unpublish dependency order is defined in SERIAL_ITEM_PUBLISH_ORDER in the same file.

Common Development Patterns

  • Adding constants: Add to ItemType enum + SERIAL_ITEM_PUBLISH_ORDER in src/fabric_cicd/constants.py
  • Adding publisher: Extend ItemPublisher + register in _base_publisher.py factory
  • Adding public exports: Update __all__ in src/fabric_cicd/__init__.py

Testing Guidelines

Always add/update tests for:

  • New functionality or features
  • Bug fixes that change behavior
  • Core logic changes in any module
  • Publisher classes and deployment logic
  • Configuration and validation logic
  • API integrations and external calls

Testing approach: Mock all external dependencies, use requests_mock for Azure APIs, tmpdir for file operations. Focus on testing business logic, error handling, and integration points.

Test file naming: Follow the conventions in the tests/ directory. Review existing test files to match the naming pattern before creating new ones.

Files to Avoid Modifying

  • coverage_report/, site/, htmlcov/ - Auto-generated
  • uv.lock - Managed by uv
  • .github/workflows/ - Affects CI validation

Dependencies & Testing

Runtime: azure-identity, dpath, pyyaml, requests
Development: uv, ruff, pytest, mkdocs-material

Test Types: Unit (tests/test_*.py), Integration (mocked APIs), Parameter/File Handling, Workspace management

GitHub Actions: test.yml (PR tests), validate.yml (formatting/linting), bump.yml (version bumps - vX.X.X format)

Microsoft Fabric APIs: https://learn.microsoft.com/en-us/rest/api/fabric/

Pull Request Requirements

Base branch: Always target main unless otherwise specified.

Title format: "Fixes #123 - Short Description" where #123 is the issue number

  • Use "Fixes" for bug fixes, "Closes" for features, "Resolves" for other changes
  • Example: "Fixes #520 - Add Python version requirements to documentation"
  • Exception: Version bump PRs use "vX.X.X" format only

Requirements:

  • PR description should be copilot generated summary
  • Pass ruff formatting and linting checks
  • Pass all tests
  • All PRs must be linked to valid GitHub issue

Do Not

  • Do not modify uv.lock manually — it is managed by uv
  • Do not import from internal modules (e.g., fabric_cicd._items) — only use the public API from fabric_cicd
  • Do not add print() statements — use the standard logging module
  • Do not create PRs without a linked GitHub issue
  • Do not modify .github/workflows/ files unless explicitly required

Agent Troubleshooting

Common Failures:

  • Import errors: Use uv run python prefix to ensure virtual environment
  • Test pollution: Azure credentials interfering - ensure proper mocking
  • Setup failures: Run uv sync --dev if modules missing
  • Formatting issues: Run uv run ruff format to auto-fix most issues
  • CI failures: Missing format/lint step in validation workflow

Authentication Strategy for Agents:

  1. For testing/imports: No auth needed
  2. For publish operations: Use AzureCliCredential() (If CredentialUnavailableError occurs, user needs to run az login first)
  3. Context: Import check works without auth, but publish operations require credentials

Key Files to Monitor

Core System Files:

  • src/fabric_cicd/constants.py - Version and configuration constants
  • src/fabric_cicd/fabric_workspace.py - Main workspace management class
  • src/fabric_cicd/publish.py - Main deployment entry points
  • src/fabric_cicd/_items/ - Publisher classes for all item types
  • src/fabric_cicd/_common/ - Config utilities, validation, and exceptions

Configuration Files:

  • pyproject.toml - Project dependencies and configuration
  • sample/workspace/parameter.yml - Environment-specific parameter template

Project Structure:

  • sample/workspace/ - Example Microsoft Fabric item structures

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.