Skip to main content

get-cdk: CDK环境安装工具

本工具旨在简化CDK环境的安装,提供基于服务的隔离运行环境,支持并行服务部署。

安装

堡垒机

无需任何操作,get-cdk已经安装在堡垒机上,直接使用即可。

本地开发机

使用pip安装get_cdk

pip install get-cdk

Usage

$ get-cdk --help
usage: get-cdk [-h] [--cdk-tag CDK_TAG] [--cdk-branch CDK_BRANCH] [--cdk-commit CDK_COMMIT] --service SERVICE args

安装cdk

options:
  -h, --help            show this help message and exit
  --cdk-tag CDK_TAG     cdk的tag
  --cdk-branch CDK_BRANCH
                        cdk的分支
  --cdk-commit CDK_COMMIT
                        cdk的commit
  --service SERVICE     要部署的服务名称, 跟服务所在的 github project 名称相同
  args                  run_cdk的参数

开发流程说明

开发服务

在本地开发机上使用 get-cdk, get-cdk 生成的 venv 放置在 $CDK_VENV_DIR 目录下, cdk 运行需要的临时文件放置在 $CDK_DIR 目录下。

  • 当没有设置 CDK_VENV_DIR 环境变量时默认值为 ~/.get_cdk/<service>/venv
  • 当没有设置 CDK_DIR 环境变量时默认值为 ~/.get_cdk/<service>/config

其中 <service> 为服务名

get-cdk --service=otg-sim
# 不添加 run_cdk 参数时仅创建 venv 并打印其路径

默认使用最新版的 cdk, 可以通过 --cdk-branch 和 --cdk-commit 参数指定 cdk 的分支和 commit 创建 venv

venv创建完成后,可以在pycharm中添加 <venv_path>/bin/python3 为python解释器,然后在pycharm中开发cdk和服务。

如需开发cdk本身可以直接clone cdk后attach到项目中。

在 venv 中可以直接运行 deploy.py 部署服务。

本地打包

需将 deploy.py 以及对应的依赖打成 sdist 包, 如使用了 airflow dag 可以和 deploy.py 打到一个 sdist 包中或分开独立打包.

在本地开发机上使用本地的打包结果部署服务:

  • 需设置环境变量 CDK_LOCAL_DIST 为 <service>=<dist_path>; 其中 <service> 为服务名, <dist_path> 为本地打包结果的目录
  • 在 venv 中运行 python3 -m cdk.run_cdk --service=<service> --tag=dummy-local 部署服务, 其中 dummy-local 表示使用本地打包结果

ci 打包

ci 打包完成后可以在开发机上部署,部署命令如下:

get-cdk --service=otg-sim --cdk-branch=master --cdk-commit=196c3de --branch=master --commit=4b5d056 --action apply
# 添加 run_cdk 的参数会直接传递给 run_cdk 进行服务部署

也可以在堡垒机上执行以上命令部署.

Metadata

Release files for get-cdk 2025.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for get-cdk 2025.6.0
File Size Uploaded
get_cdk-2025.6.0.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for get-cdk 2025.6.0
File Interpreter ABI Platform
get_cdk-2025.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / get_cdk-2025.6.0.tar.gz

Download URL get_cdk-2025.6.0.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5bd9c21407ce8c330f150bff61fce43241c54f91034320f56375ef985d179790
BLAKE2b-256 checksum
How to use checksums
ac2afc123814f2f4829716e0fa4f3d1131a6cfca919af855b9058e357a200207
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 17, 2025.

Transparency log

Release files / get_cdk-2025.6.0-py3-none-any.whl

Download URL get_cdk-2025.6.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
139e4a4af20049d7cdaeb85d3515c937c59fabdcbcb837bda86e6f797c1564e2
BLAKE2b-256 checksum
How to use checksums
704d7dfd99c8871c0c51a93de72bcc4f6fd4fd4b66d503e900d4e031ef2eb682
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 17, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

2025.6.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page