A production-ready, enterprise-scale Databricks Asset Bundles framework featuring intelligent CI/CD workflows, advanced data quality validation, and enterprise security patterns.
This project delivers a complete enterprise-grade framework for managing Databricks workloads using Asset Bundles with cutting-edge DevOps practices:
- π§ Intelligent CI/CD Workflows - Path-based execution that runs only relevant jobs
- π Enterprise Security - OAuth Service Principal authentication, no more personal tokens
- π Advanced Data Quality - Statistical anomaly detection, schema evolution validation
- π Multi-Environment Support - Seamless dev/staging/production deployments
- β‘ Performance Optimized - Secret caching, retry mechanisms, serverless computing
- π‘οΈ Production Ready - Comprehensive error handling, backup strategies, monitoring
- Intelligent Workflows: Automatically detects Python vs YAML changes and runs only necessary jobs (~13s for no relevant changes)
- Enterprise Authentication: Uses Service Principals for all environments, following security best practices
- Advanced Data Platform: Includes statistical validation, anomaly detection, and schema evolution checks
- Developer Experience: Pre-commit hooks, comprehensive testing, and detailed troubleshooting guides
databricks-enterprise-bundles/
βββ .databricks/ # Bundle variable overrides for each environment
β βββ bundle/
β βββ dev/ # Development environment variables
β βββ staging/ # Staging environment variables
β βββ prod/ # Production environment variables
βββ .github/ # Intelligent CI/CD workflows and actions
β βββ actions/ # Reusable composite actions
β βββ workflows/ # Modular workflow definitions
β βββ ci-dev.yml # Development CI with intelligent detection
β βββ pr-validation.yml # PR validation with multi-env checks
β βββ deploy-staging.yml # Staging deployment with prod validation
β βββ deploy-production.yml # Production deployment on releases
βββ src/ # Enterprise-grade source code
β βββ libraries/ # Enhanced Python libraries with caching, retry logic
β β βββ data_quality.py # Statistical validation & anomaly detection
β β βββ secret_manager.py # Intelligent secret caching & management
β βββ notebooks/ # Production-ready notebooks with error handling
βββ tests/ # Comprehensive test suites
β βββ unit/ # Unit tests with mocked dependencies
β βββ integration/ # Integration tests for full pipeline
βββ presentation/ # Executive presentation materials
βββ monitoring/ # Enterprise monitoring and observability
βββ security/ # Security policies and configurations
βββ Documentation Files # Comprehensive guides and troubleshooting
βββ TROUBLESHOOTING.md # Complete troubleshooting guide
βββ DATABRICKS_CLI_SETUP.md
βββ GITHUB_SETUP.md
βββ SLACK_INTEGRATION.md
βββ CONTRIBUTING.md
The framework follows a three-tier environment strategy:
- Development: Individual developer workspace for testing and experimentation
- Staging: Pre-production environment for integration testing
- Production: Live production environment with enhanced monitoring and reliability
Implements the medallion architecture pattern:
- Bronze Layer: Raw data ingestion with minimal transformation
- Silver Layer: Cleaned and standardized data with business rules applied
- Gold Layer: Aggregated and enriched data ready for consumption
- Python 3.9+ with pip
- Modern Databricks CLI (installed via setup script)
- Git for version control
- GitHub CLI (optional, for PR management)
- Databricks workspace with appropriate permissions
-
Clone and setup:
git clone https://github.com/merca/databricks-enterprise-bundles.git cd databricks-enterprise-bundles pip install -r requirements.txt -
Install Databricks CLI (modern version):
# The setup script installs the correct CLI version curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/main/install.sh | sh
-
Configure authentication (OAuth Service Principal recommended):
# Set environment variables (see ENVIRONMENT_VARIABLES.md) export DATABRICKS_HOST="https://your-workspace.cloud.databricks.com" export DATABRICKS_CLIENT_ID="your-service-principal-id" export DATABRICKS_CLIENT_SECRET="your-service-principal-secret"
-
Test the setup:
# Validate bundle configuration databricks bundle validate --target dev # Run tests pytest tests/unit/
-
Deploy to development:
databricks bundle deploy --target dev databricks bundle run data_processing_job --target dev
π Need help? Check TROUBLESHOOTING.md for common issues and solutions.
cd bundles/dev
databricks bundle deployUse the automated CI/CD pipeline by pushing to the appropriate branches:
- Push to
nextbranch for dev deployment - Push to
currentbranch for staging and production deployment
Each environment has its own configuration file in configs/environments/:
# configs/environments/dev.yml
variables:
service_principal_id: "dev-databricks-sp@company.com"
notification_email: "dev-team@company.com"
workspace_url: "https://dev-workspace.cloud.databricks.com"
catalog_name: "dev_catalog"
schema_name: "dev_schema"
cluster_node_type: "i3.xlarge"
min_workers: 1
max_workers: 4
# ... additional configurationEach environment has a databricks.yml file defining:
- Resource definitions (jobs, pipelines, clusters)
- Environment-specific variables
- Deployment targets and permissions
Our cutting-edge CI/CD system features intelligent path-based execution that dramatically improves developer productivity:
- Python Changes: Triggers lint, test, and Databricks validation jobs
- YAML/Config Changes: Runs only Databricks validation jobs
- No Relevant Changes: Ultra-fast ~13 second feedback
- Mixed Changes: Executes all necessary jobs intelligently
- OAuth Service Principals: No more personal access tokens
- Multi-Environment Secrets: Separate credentials for dev/staging/prod
- Secure Secret Caching: 5-minute TTL with intelligent invalidation
- Retry Mechanisms: Exponential backoff for transient failures
- PR Validation - Comprehensive checks on every pull request
- Development CI - Automatic deployment on
nextbranch - Staging Deployment - Full environment testing on
currentbranch - Production Release - Triggered by release tags with rollback capability
- Monitoring & Alerts - Slack notifications and health monitoring
graph TD
A[Code Push] --> B[Lint & Test]
B --> C[Validate Bundles]
C --> D{Branch?}
D -->|next| E[Deploy to Dev]
D -->|current| F[Deploy to Staging]
F --> G[Integration Tests]
G --> H[Deploy to Production]
H --> I[Smoke Tests]
I --> J[Monitor Health]
The framework includes a comprehensive data quality validation system:
- Completeness checks: Null value validation, empty string detection
- Validity checks: Format validation, range checks, allowed values
- Consistency checks: Uniqueness validation, referential integrity
- Custom business rules: Configurable validation logic
from src.libraries.data_quality import DataQualityValidator
# Define validation rules
rules = {
"completeness": {
"customer_id": {"null_threshold": 0.0},
"transaction_amount": {"null_threshold": 0.05}
},
"validity": {
"transaction_amount": {"min_value": 0.01, "max_value": 100000.00},
"transaction_type": {"allowed_values": ["PURCHASE", "REFUND", "TRANSFER"]}
},
"consistency": {
"customer_id": {"unique": True}
}
}
# Validate DataFrame
validator = DataQualityValidator(rules)
results = validator.validate(df)
# Generate quality report
report = validator.generate_quality_report(df, "/path/to/report")-
Copy job template:
cp templates/jobs/job_template.yml bundles/dev/resources/jobs/my_new_job.yml
-
Customize job configuration
-
Add notebook or library code to
src/ -
Test locally in development environment
-
Commit and push for automated deployment
- Use notebook templates from
src/notebooks/ - Follow established patterns for:
- Configuration management
- Error handling and logging
- Data quality validation
- Performance optimization
Code promotion follows this pattern:
- Development β Feature branch β
nextbranch - Integration testing in staging
- Production deployment via
currentbranch
The deployment includes automatic health monitoring:
- Job execution status
- Pipeline health checks
- Workspace accessibility
- Unity Catalog connectivity
- Performance metrics
Configure alerts for:
- Failed job executions
- Pipeline failures
- Data quality issues
- Performance degradation
Comprehensive logging across all components:
- Structured logging format
- Centralized log aggregation
- Error tracking and alerting
- Service principals for production workloads
- Role-based access control (RBAC)
- Principle of least privilege
- Secret management via Azure Key Vault/AWS Secrets Manager
- Unity Catalog integration
- Column-level security
- Data lineage tracking
- Audit logging
For reusable bundle templates and starter patterns, see the companion template repository:
- Bundle Templates: Standardized project structures and configurations
- Best Practice Patterns: Pre-configured jobs, notebooks, and pipelines
- Quick Start Templates: Ready-to-use templates for common use cases
This repository focuses on the production enterprise implementation with advanced features.
- Use parameterized notebooks for flexibility
- Implement comprehensive error handling
- Follow naming conventions consistently
- Document all business logic
- Include data quality checks at every layer
- Cluster autoscaling configuration
- Photon acceleration for pipelines
- Delta table optimizations (Z-ordering, auto-compaction)
- Caching strategies
- Automatic cluster termination
- Spot instance utilization
- Resource right-sizing
- Budget alerts and monitoring
- Cross-region replication strategies
- Disaster recovery planning
- Data residency compliance
- Fork the repository
- Create a feature branch
- Follow coding standards and templates
- Add tests for new functionality
- Update documentation
- Submit pull request
- Follow PEP 8 for Python code
- Use type hints
- Write comprehensive docstrings
- Include unit tests
- Maintain test coverage above 80%
- Bundle validation failures: Check YAML syntax and required fields
- Permission errors: Verify service principal permissions
- Resource conflicts: Ensure unique resource names across environments
- Network connectivity: Verify workspace access and firewall rules
- Check the
docs/directory for detailed documentation - Review GitHub Issues for known problems
- Contact the Data Engineering team for support
This project is licensed under the MIT License - see the LICENSE file for details.
- v1.0.0: Initial enterprise framework release
- v1.1.0: Added advanced monitoring and alerting
- v1.2.0: Enhanced security and compliance features
Maintained by: Data Engineering Team Last Updated: 2025-10-10