#version #applications #querying #apps #command-line-tool #verify #corrosion

bin+lib corrator

用于验证 Docker 容器内使用的应用程序版本的工具

24 个版本 (7 个稳定版)

1.3.0 2024 年 6 月 12 日
1.2.3 2024 年 3 月 21 日
1.2.2 2023 年 10 月 26 日
1.2.0 2023 年 7 月 17 日
0.2.4 2023 年 6 月 26 日

#139Unix API

MIT/Apache

35KB
611

Corrator

crates.io Documentation MIT or Apache 2.0 licensed Dependency Status downloads ko-fi

监控您的 Docker 容器中的腐蚀。

这是什么?

Corrator 是一个命令行工具,用于查询 Docker 容器并请求其中应用程序的版本号。

为什么需要这个?

如果您需要维护大量容器,每个容器都有自己的应用程序和依赖项,您可能会熟悉保持这些依赖项的时效性是多么困难。您不希望让您的依赖项超出其支持的生命周期,但您也不希望在推送更新时必须更新某个地方的主列表。

Corrator 允许您定义一组容器,每个容器都有一个重要依赖项的列表。运行 corrator 将会拉取容器,进入容器,并对每个依赖项运行版本命令。然后它会以最简形式输出其发现的内容。

对于意外由出色的 endoflife.date 服务跟踪的依赖项,您可以可选地请求 Corrator 查找当前已安装版本的当前生命终结日期,并告诉您。

安装 Corrator

从 Crates.io

安装 Rust

有关安装 Rust 的信息,请参阅 rust 文档

安装 Corrator

您可以使用以下命令直接从 crates.io 安装 corrator:

cargo install corrator

使用 Corrator

假设您有一个有效的配置文件(请参阅下面的说明),您可以直接从命令行运行 corrator

corrator

有关其他选项,请参阅 corrator --help

配置 Corrator

Corrator 的核心是一个配置目录,其中包括两个文件

applications.toml

[bash]

# The actual command to run to get a version
version_command = "bash --version"

# Command's version format as a regex
#   "version" named group is mandatory
version_regex = '''GNU bash, version (?P<version>[0-9.]+)'''

# Optional for endoflife.date support
[eol]
# The "product name" as it exists in endoflife.date
# yes, I'm aware bash isn't actually on endoflife.date
product_name = "bash"

# regex for which parts of version endofdate is looking for
#   e.g., Rails only wants version in X.X format
version_regex = '''.+'''

containers.toml

[ubuntu]

# The docker registry full path
path = "ubuntu"

# An array of applications to be queried
#   These must be defined in this file
apps = [ "bash" ]

# An array of tags
#   These can be anything sting you want
#   You can filter them with `--tag` and `--filter`
#   See `corrator --help` for more detail
tags = [ "mytag1", "mytag2" ]

Corrator 将按照以下顺序在这些位置中查找这些文件

  1. 您系统的用户配置位置(请参阅 corrator --help 以找到此路径)
  2. 使用 --c path_to_directory 标志

该仓库中还有一个examples示例,可以帮助您入门。

许可证

许可协议为以下之一:

由您选择。

贡献

除非您明确说明,否则根据 Apache-2.0 许可证定义,您有意提交的任何贡献,包括但不限于工作,都应按上述方式双许可,无需任何额外条款或条件。

依赖项

~22-36MB
~616K SLoC