A CI/CD test project utilizing Databricks Asset Bundle. This project provides structure and utilities for efficiently managing and deploying Python modules and notebooks in Databricks environments.
📖 한국어 문서: README-KR.md
test_cicd_01/
├── src/ # Source code
│ ├── test_cicd_01/ # Main package
│ │ ├── main.py # Spark-based main application
│ │ └── __init__.py # Package initialization (v0.0.1)
│ ├── module/ # Common modules
│ │ ├── path_manager.py # Path management utility
│ │ └── util.py # Basic utility functions
│ ├── foo/ # Example module
│ │ └── bar.py # Resource file reading example
│ ├── main.ipynb # Main notebook (module usage examples)
│ └── set_notebook_paths.ipynb # Notebook path configuration utility
├── resources/ # Resource files
│ ├── test_cicd_01.job.yml # Databricks Job definition
│ └── foo/bar.yml # Example configuration file
├── tests/ # Test code
│ ├── foo/test_read_resource.py
│ └── module/test_path_manager.py
├── config/ # Configuration files directory
├── databricks.yml # Databricks Bundle configuration
└── setup.py # Python package setup
- Path management class implemented with Singleton pattern
- Provides absolute paths to various directories within Bundle in Databricks environment
- Supported paths:
resources,config,tests
from module.path_manager import PathResolver
paths = PathResolver()
print(paths.resources) # Resources directory path
print(paths.config) # Configuration directory path
print(paths.tests) # Tests directory pathset_notebook_paths.ipynb: Automatically configures sys.path for importing Python modules in Databricks notebooks- Dynamic path configuration based on Bundle name
- YAML configuration file reading example
- Safe file access through path manager
from foo.bar import parse_bar
content = parse_bar() # Read resources/foo/bar.yml fileInstall Databricks CLI:
pip install databricks-cliAuthenticate to Databricks workspace:
databricks configureDeploy to development environment:
databricks bundle deploy --target devDeploy to production environment:
databricks bundle deploy --target prodRun deployed Job:
databricks bundle runInstall development dependencies:
pip install -r requirements-dev.txtRun tests:
pytestThe project includes the following tests:
- Path Manager Tests: Verify proper operation of PathResolver class
- Resource File Reading Tests: Validate YAML file reading functionality
# Run all tests
pytest
# Run specific tests
pytest tests/module/test_path_manager.py
pytest tests/foo/test_read_resource.py- Databricks Connect: Connect to Databricks cluster from local IDE
- Visual Studio Code Extension: Databricks development environment integration
- pytest: Unit testing framework
This project uses Databricks Asset Bundle to configure CI/CD pipeline:
- Git Integration: Source management based on GitHub repository
- Automated Deployment: Development/production environment separation through Bundle
- Job Scheduling: Automated workflow execution support
For more details, refer to the Databricks Asset Bundles documentation.