CLI tool for managing FDP Workflow Engine bundles
Project description
FDP Bundle CLI
CLI tool để quản lý và deploy workflow bundles cho FDP Workflow Engine.
Cài đặt
pip install fdpbundle
Hoặc cài đặt từ source:
git clone https://gitlab.example.com/data-team/fdpbundle.git
cd fdpbundle
pip install -e .
Bắt đầu nhanh
1. Khởi tạo project mới
fdpbundle init my-project
cd my-project
Lệnh này sẽ tạo ra cấu trúc:
my-project/
├── bundles/
│ └── example/
│ └── bundle.json
├── .gitlab-ci.yml
├── .gitignore
├── .env.example
└── README.md
2. Cấu hình credentials
cp .env.example .env
# Chỉnh sửa .env với credentials của bạn
Hoặc export environment variables:
export WORKFLOW_ENGINE_URL=https://airflow.example.com/fdp_tools
export WORKFLOW_ENGINE_SESSION=your-session-cookie
3. Validate bundle
fdpbundle validate bundles/example/bundle.json
4. Deploy
# Deploy lên DEV
fdpbundle deploy bundles/example/bundle.json --env dev
# Dry run trước khi deploy production
fdpbundle deploy bundles/example/bundle.json --env prod --dry-run
# Deploy production
fdpbundle deploy bundles/example/bundle.json --env prod
Commands
fdpbundle init [PROJECT_NAME]
Khởi tạo project FDP bundles mới với cấu trúc chuẩn.
fdpbundle init my-project
fdpbundle init # Sử dụng tên mặc định 'fdp-bundles'
fdpbundle init my-project --force # Ghi đè nếu đã tồn tại
fdpbundle validate BUNDLE_FILE
Validate bundle spec với Workflow Engine API.
fdpbundle validate bundles/etl-pipeline/bundle.json
fdpbundle import BUNDLE_FILE
Import bundle spec vào hệ thống (tạo version mới).
fdpbundle import bundles/etl-pipeline/bundle.json
fdpbundle import bundles/etl-pipeline/bundle.json --no-set-current
fdpbundle diff BUNDLE_FILE
So sánh bundle với trạng thái hiện tại.
fdpbundle diff bundles/etl-pipeline/bundle.json --env dev
fdpbundle diff bundles/etl-pipeline/bundle.json --env prod -v # Verbose
fdpbundle apply BUNDLE_FILE
Apply bundle changes lên môi trường.
fdpbundle apply bundles/etl-pipeline/bundle.json --env dev
fdpbundle apply bundles/etl-pipeline/bundle.json --env prod --dry-run
fdpbundle deploy BUNDLE_FILE
Full deployment flow: validate → import → diff → apply
fdpbundle deploy bundles/etl-pipeline/bundle.json --env dev
fdpbundle deploy bundles/etl-pipeline/bundle.json --env prod --dry-run
Global Options
| Option | Environment Variable | Mô tả |
|---|---|---|
--api-url |
WORKFLOW_ENGINE_URL |
URL của Workflow Engine API |
--session |
WORKFLOW_ENGINE_SESSION |
Airflow session cookie |
-v, --verbose |
- | Hiển thị output chi tiết |
--version |
- | Hiển thị version |
--help |
- | Hiển thị help |
CI/CD Integration
Package này được thiết kế để sử dụng trong GitLab CI/CD. Khi chạy fdpbundle init, file .gitlab-ci.yml sẽ được tạo tự động với các jobs:
- validate:changed-bundles - Validate các bundle files đã thay đổi
- deploy:dev - Auto deploy lên DEV khi push vào
devbranch - deploy:stg - Auto deploy lên Staging khi push vào
stgbranch - deploy:prod - Manual deploy lên Production khi push vào
mainbranch
GitLab Variables cần cấu hình
| Variable | Protected | Masked |
|---|---|---|
WORKFLOW_ENGINE_URL_DEV |
No | No |
WORKFLOW_ENGINE_URL_STG |
Yes | No |
WORKFLOW_ENGINE_URL_PROD |
Yes | No |
WORKFLOW_ENGINE_SESSION_DEV |
No | Yes |
WORKFLOW_ENGINE_SESSION_STG |
Yes | Yes |
WORKFLOW_ENGINE_SESSION_PROD |
Yes | Yes |
Development
Setup development environment
git clone https://gitlab.example.com/data-team/fdpbundle.git
cd fdpbundle
pip install -e ".[dev]"
Run tests
pytest
Code formatting
black src/
ruff check src/
Bundle JSON Schema
{
"bundle": {
"name": "string (required, unique)",
"description": "string",
"owner": "string"
},
"workflows": [
{
"name": "string (required)",
"description": "string",
"schedule_interval": "cron expression or null",
"tasks": [...]
}
],
"environments": {
"dev": { "overrides": {...} },
"stg": { "overrides": {...} },
"prod": { "overrides": {...} }
}
}
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fdpbundle-0.2.0.tar.gz.
File metadata
- Download URL: fdpbundle-0.2.0.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88027051875d73b2aab2652b175e02fd8534616c6033b11c15cf7b383043089c
|
|
| MD5 |
60301aad6ccba52bcaa55474e5db3fcb
|
|
| BLAKE2b-256 |
57ab075413904a82ba55aa36deecbb3ad226e40aedfe269b8593563f4a9721e5
|
File details
Details for the file fdpbundle-0.2.0-py3-none-any.whl.
File metadata
- Download URL: fdpbundle-0.2.0-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cf9e9c929dac96cc95400ad85a569db2abcc18c2f58c6959aeb7bd8d2f4a24a
|
|
| MD5 |
4a0db5608865d5a1e4c8db128d893981
|
|
| BLAKE2b-256 |
d9925d5fdcfce3537159310a09f693df50897a095a8ab97796023877ac7a35fa
|