zicht/z-plugin-refs

此包已被废弃,不再维护。未建议替代包。

一个从部署创建引用的refs插件

2.0.4 2017-02-09 10:01 UTC

This package is not auto-updated.

Last update: 2022-02-11 10:20:18 UTC


README

此插件将创建从部署的树中提交的提交(如果引用已存在且以旧引用为父引用),并将提交哈希保存/更新到位于refs/envs/{{target_env}}的引用中。例如,如果将部署到生产环境,则引用将存储在refs/envs/production(或在工作目录./git/refs/production)中。

因此,它基本上是从部署到环境的提交创建新的时间线/历史记录,因为它基本上是一个以refs/envs/{{target_env}}为头的分支,您可以执行您通常使用分支执行的所有操作。

安装

将引用添加到项目的插件中

plugins: [... 'refs']

它钩入post deploy并添加一些额外的命令。

  env:refs:remote:fetch    Fetch the refs from the remote
  env:refs:remote:push     Push the reft to remote
  env:refs:show            Prints matching refs (tags, branches etc.) that match the same tree as the ref.

示例

打印日志

~# git reflog refs/envs/production

commit aa33bceb41dee4e97b92645809455dca49c0b6ba
Author: philip <philip@zicht.nl>
Date:   Wed Oct 26 11:51:32 2016 +0200

    [z] Commit from: '6876a77 capitalize first char'

或者

~# git reflog refs/envs/production
aa33bce refs/envs/production@{0}: [z] new ref for 6876a77b43256710f882c744eb117decde9ce222

执行回滚

z deploy production envs/production~1

检查部署的差异

git diff envs/production~1 envs/production

依赖

lib 描述
zicht/z-plugin-git 因为它如果不用git将没有用处
php > 5.6.0 内部使用了一些只有从 > 5.6 才有的功能(可变参数函数和参数解包)