39 个版本

0.7.15 2024年2月8日
0.7.13 2023年1月27日
0.7.12 2022年10月15日
0.7.9 2022年5月31日
0.4.7 2020年10月28日

#113配置

MIT 许可证

83KB
2K SLoC

CEPler

Capricious Environment Propagator(随机环境传播器)旨在帮助您管理部署到多个环境的系统文件的文件状态。

安装

如果您有 Rust 工具链,您可以

cargo install cepler

否则,预编译的二进制文件附在 github 发布版 中,可以下载并解压。

使用方法

要使用 cepler,首先您必须编写一个配置文件(默认情况下期望在 cepler.yml,但可以通过 -c 标志或 CONFIG_FILE 环境变量覆盖)。配置文件指定

  • 存在哪些环境
  • 哪些文件与特定环境相关
  • 如何在不同环境间传播配置文件

cepler.yml

environments:
  # The Name of the Environment
  testflight:

    # List of files (globs) that should (always) trigger a redeploy of this environment
    latest:
    - k8s/service.yml
    - k8s/testflight.yml

  staging:
    # The preceeding environment
    passed: testflight
    # The files that should trigger once they have been propagated from the preceeding environment
    propagated:
    - k8s/service.yml

    latest:
    - k8s/staging.yml

  production:
    passed: staging
    propagated:
    - k8s/service.yml
    latest:
    - k8s/production.yml

cepler 有 3 个基本命令 checkpreparerecord

  • cepler check -<环境> - 检查环境是否需要部署
  • cepler prepare -<环境> - 准备当前目录中已签出的文件的状态以便部署
  • cepler record -<环境> - 记录(并提交)当前签出的与特定环境相关的文件的相关元数据

还有许多其他 CLI 标志,通过 cepler help [子命令] 描述

$ cepler --help
cepler 0.5.0

USAGE:
    cepler [OPTIONS] <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --clone <CLONE_DIR>                    Clone the repository into <dir>
    -c, --config <CONFIG_FILE>                 Cepler config file [env: CEPLER_CONF=]  [default: cepler.yml]
        --git-branch <GIT_BRANCH>              Branch for --clone option [env: GIT_BRANCH=]  [default: main]
        --git-private-key <GIT_PRIVATE_KEY>    Private key for --clone option [env: GIT_PRIVATE_KEY=]
        --git-url <GIT_URL>                    Remote url for --clone option [env: GIT_URL=]

SUBCOMMANDS:
    check        Check wether the environment needs deploying. Exit codes: 0 - needs deploying; 1 - internal error;
                 2 - nothing to deploy
    concourse    Subcommand for concourse integration
    help         Prints this message or the help of the given subcommand(s)
    ls           List all files relevent to a given environment
    prepare      Prepare workspace for hook execution
    record       Record the state of an environment in the statefile
    reproduce    Reproduce workspace according to last recorded state
    
$ cepler help prepare
cepler-prepare
Prepare workspace for hook execution

USAGE:
    cepler prepare [FLAGS] --environment <ENVIRONMENT>

FLAGS:
        --force-clean    Delete all files not referenced in cepler.yml
    -h, --help           Prints help information

OPTIONS:
    -e, --environment <ENVIRONMENT>    The cepler environment [env: CEPLER_ENVIRONMENT=]

Concourse

有关集成到 Concourse 管道的说明,请参阅 concourse/README.md 中的说明

依赖项

~11–16MB
~390K SLoC