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.1.0.tar.gz (15.0 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.1.0-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fdpbundle-0.1.0.tar.gz
Algorithm Hash digest
SHA256 429bb49304e82e2821816c51c1cdf4e66f87345bba6ed2b0b98b2cca60e3bb9f
MD5 989a373d4820006b989d399b5a05dfc1
BLAKE2b-256 cad80f955871062ed74b13fa1c89dce09f80cc4306bca10e461a016755ee9dee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fdpbundle-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.9 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22b36eb71c17b38ec7982f867de776960747dbb302fff56d8803b394a22ec9fa
MD5 8111ef92b2814aaff3a156eb30700c6b
BLAKE2b-256 6ecffb63a9bc4641166097d2f74ff5d2480d2ba28dc3fbaeaf16edc3652d52eb

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