简单升级包
简单升级包用于将同一个 Package 从低版本升级到高版本
创建简单升级包
$ ambot-packager convert-update -h
将一个 ambot 软件包转换为升级包
Usage:
ambot-packager convert-update <install-package-path> [flags]
Flags:
-h, --help help for convert-update
--source-allow strings
--source-expr string
使用 ambot-packager convert-update /path/to/xxx.ambot 即可在 .ambot 同目录下生成 xxx.ambotup 简单升级包
必须限制只有从哪个版本到哪个版本才可以用这个升级包升级,支持两种方式
source-allow
可以罗列若干个来源版本,可以将这个 flag 传递多次或是多个用逗号分隔。版本号没有前缀v
--source-allow 1.0.0代表仅允许从 v1.0.0 升级--source-allow 1.0.0,1.1.0和--source-allow 1.0.0 --source-allow 1.1.0代表仅允许从 v1.0.0 或 v1.1.0 升级
source-allow 是支持指定一个更高版本的,即允许降级
source-expr
用于指定一组满足条件的版本,可以从所有满足该表达式的版本进行升级
具体语法请参考 语义化版本号 - 约束
*不支持先行版本号- 指定多个表达式时,满足任一即可
- source-expr 不可用于降级
利用简易安装包升级
$ ./xxx.ambotup -h
Usage:
ambot-update-simple [flags]
Flags:
-T, --allow-no-tag allow install no-tag package
--unsafe-allow-dirty (unsafe) allow install dirty package
--start strings services should start after update
--enable strings services should enable after update
--not-start strings services should not start after update
--not-enable strings services should not enable after update
-S, --not-start-new do not start new service after update
-E, --not-enable-new do not enable new service after update
-y, --yes auto confirm for all choices
-s, --just-show just show info (not install)
--as-installer 将升级包作为安装包使用
--author Author standard 'Name <name@example.com>' format
-h, --help help for ambot-update-simple
与安装包类似,简单升级包是以 .ambotup 为后缀,赋予可执行权限后可以直接执行
手动使用
手动使用时,直接执行 ./xxx.ambotup 即可,会交互式的引导你输入一系列的内容
自动化使用
如果想要在自动化中使用(非交互式),请遵循如下要求
- 始终传递
-y来跳过确认 - 始终传递
--author参数,例如--author 'ci@tophant.com' - 始终对服务指定
--start--not-start、--enable--not-enable
默认情况下,升级会保持原有服务的启用/启动状态不同,并将新的服务的启用/启动状态设定为开 可以通过
--start--not-start--not-start-new--enable--not-enable--not-enable-new来修改这个默认行为 自动化中始终建议明确的设定这个行为
allow-no-tag, unsafe-allow-dirty
与 安装 里面的一致,这里的 unsafe-allow-dirty 仅用于安装 Dirty Package
如果本身相关 Package 处于 Update Dirty 的状态,则必须手动 revert,具体可参考 术语:Dirty
利用简易升级包安装
某些情况可能不想升级,而是想直接安装。因为升级包中存储了全量的安装包,因此这是可行的,仅需指定 --as-installer 参数即可。
--as-installer 是一个特殊参数,会完全改变程序的行为,使用 --as-installer 时其他参数遵从安装包安装的参数,而不是升级的参数
$ ./xxx.ambotup --as-installer -h
ambot-install [flags]
Flags:
-T, --allow-no-tag allow install no-tag package
-c, --clean clean package (not execute)
-h, --help help for ambot-install
-s, --just-show just show info (not install)
--just-show-tag just show tag (not install)
--just-show-version just show version (not install)
-E, --not-enable do not enable service after install
-S, --not-start do not start service after install
--unsafe-allow-dirty (unsafe) allow install dirty package
-y, --yes auto confirm for all choices
例如,常见的错误是,在自动化中错误的传递了 --author
具体文档请参考 安装
修改简单升级包的可用来源版本
某些情形下,可能出现打了升级包,现场发现来源版本不对,需要修改的场景,做法是将它「恢复」成安装包,再重打升级包。
ambot-packager convert-update-back ./xxx.ambotup
ambot-packager convert-update ./xxx.ambot --source-expr '1.2.3'