跳转到主要内容

Python CLI用于管理Helm Chart依赖项

项目描述

helm-upgrade

PyPI version pre-commit.ci status CI Tests codecov

你是否管理一个依赖于其他Helm Charts的Helm Chart?你是否厌倦了手动更新这些依赖项?那么这个工具就是为你准备的!helm-upgrade是一个Python命令行界面(CLI),可以自动更新本地Helm Charts的依赖项。

这个工具受到了bump-helm-deps-action的启发。

目录


:rocket: 安装

建议使用Python 3.8与该工具一起使用。

:snake: pip

pip install helm-upgrade

:wrench: 手动

首先,克隆此存储库并将其切换到它。

git clone https://github.com/sgibson91/helm-upgrade.git
cd helm-upgrade

使用Python安装需求和包。建议使用Python 3.8。

python -m pip install .

通过调用帮助页面来测试安装。

helm-upgrade --help

:recycle: 使用

usage: helm-upgrade [-h] [--dry-run] chart_path dependencies

Update the dependencies of a local Helm Chart in a project repository.

positional arguments:
  chart_path    Path to the file containing the dependencies of the local Helm Chart to
                be updated.
  dependencies  A dictionary of Helm Chart dependencies and their host repo URLs. E.g.
                '{"nginx-ingress":
                "https://raw.githubusercontent.com/helm/charts/master/stable/nginx-
                ingress/Chart.yaml"}'

optional arguments:
  -h, --help    show this help message and exit
  --dry-run     Perform a dry run of the update. Don't write the changes to a file.

helm-upgrade

  1. 从您指定的文件中读取当前依赖项的版本,
  2. 从提供的URL(在JSON模式中)查找您想要的依赖项的最新版本(作为dependencies参数),
  3. 比较这些版本是否相等,
  4. 如果版本不相等(并且未设置--dry-run标志),则您的Helm Chart依赖项将被新的图表版本覆盖。

:wheel_of_dharma: 远程Helm Charts

helm-upgrade目前识别来自三种类型的主机上的图表版本。

  1. 另一个GitHub存储库中的Chart.yaml文件。这些URL以"/Chart.yaml"结尾。

    例如,https://raw.githubusercontent.com/helm/charts/master/stable/nginx-ingress/Chart.yaml

  2. GitHub pages上托管的图表版本库。这些URL包含"/gh-pages/"。

    例如,https://raw.githubusercontent.com/jupyterhub/helm-chart/gh-pages/index.yaml

  3. GitHub发布页面上的版本列表。这些URL以"/releases/latest"结尾,并使用BeautifulSoup来搜索html。

    例如,https://github.com/jetstack/cert-manager/releases/latest

:white_check_mark: 运行测试

要运行测试套件,您必须首先遵循手动安装说明。完成后,可以按以下方式运行测试套件

python -m pytest -vvv

要查看测试套件的代码覆盖率,请运行以下命令

python -m coverage run -m pytest -vvv
coverage report

可以通过运行以下命令访问报告的交互式HTML版本

coverage html

然后在浏览器窗口中打开htmlcov/index.html文件。

:sparkles: 贡献

:tada: 感谢您想要贡献! :tada: 确保阅读我们的行为准则贡献指南以开始。

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面