Skip to main content

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 dev branch
  • deploy:stg - Auto deploy lên Staging khi push vào stg branch
  • deploy:prod - Manual deploy lên Production khi push vào main branch

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

fdpbundle-0.5.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fdpbundle-0.5.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file fdpbundle-0.5.0.tar.gz.

File metadata

  • Download URL: fdpbundle-0.5.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for fdpbundle-0.5.0.tar.gz
Algorithm Hash digest
SHA256 0c8ce2e1d7fb841e0c54efe5a2ae5e5840bc8a46ec3c7b57648174ff64335049
MD5 55955ff60ee7e94f192690e100f22eb4
BLAKE2b-256 a44feb163b215f0fdfa8baaf959a928206c5e033029b9b91f940b35d78b684d3

See more details on using hashes here.

File details

Details for the file fdpbundle-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: fdpbundle-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for fdpbundle-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d09ebb7269cc26ef7b79fe05bfc1c77092248d7a9c62cbbada1a92622a5266c8
MD5 7cfbb6353a6ba1785b137843dd2198fe
BLAKE2b-256 30e39ec9f9edd498eae709b5eb357429819a9d816f20ecfc4dc7b70afc1ced1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page