了解如何使用推出机制逐步向用户部署更新。
推出允许你向部分用户推出更改,以在向所有用户发布更改之前捕获错误或其他问题。
¥A rollout allows you to roll out a change to a portion of your users to catch bugs or other issues before releasing that change to all your users.
EAS 根据你的用例提供每次更新和基于分支的推出机制。
¥EAS provides per-update and branch-based rollout mechanisms depending on your use case.
¥Per-update rollouts
此推出机制允许你指定发布新更新时应接收新更新的用户百分比,然后逐渐增加该百分比。
¥This rollout mechanism allows you to specify a percentage of users that should receive a new update when you publish it, and then increase that percentage gradually afterwards.
¥Starting a rollout
要启动基于更新的部署,请将 --rollout-percentage
标志添加到你的常规 eas update
命令中:
¥To start an update-based rollout, add the --rollout-percentage
flag to your normal eas update
command:
-
eas update --rollout-percentage=10
在此示例中,发布时,更新将仅对 10% 的终端用户可用。
¥In this example, when published, the update will only be available to 10% of your end users.
¥Progressing a rollout
要编辑基于更新的推出的百分比:
¥To edit the percentage of an update-based rollout:
-
eas update:edit
系统将引导你完成选择要编辑的更新的过程,并要求你输入新的百分比。
¥You will be guided through the process of selecting the update to edit and asked for the new percentage.
¥Ending a rollout
在结束基于更新的发布时,你有两个选择:
¥When ending an update-based rollout, you have two options:
全面推出:要实现此最终状态,请按上述详细说明推进部署并将百分比设置为 100。
¥Roll out fully: To accomplish this end state, progress the rollout as detailed above and set the percentage to 100.
恢复:要实现此最终状态,请使用 eas update:republish
命令重新发布上一个更新。
¥Revert: To accomplish this end state, republish the previous update by using the eas update:republish
command.
¥Working with rollouts
一次只能在分支上推出一个更新。
¥Only one update can be rolled out on a branch at one time.
要查看推出状态,请使用 eas update:list
或 eas update:view
命令。
¥To see the state of the rollout, use the eas update:list
or eas update:view
commands.
¥Branch-based rollouts
此推出机制允许你逐步将新分支上的一组更新推出给一定比例的终端用户,并将剩余比例的用户留在当前分支上。
¥This rollout mechanism allows you to incrementally roll out a set of updates on a new branch to a percentage of end users and leave the remaining percentage of users on the current branch.
¥Starting a rollout
要启动基于分支的部署,请运行以下 EAS CLI 命令:
¥To start a branch-based rollout, run the following EAS CLI command:
-
eas channel:rollout
在终端中,交互式指南将帮助你选择通道、选择要推出的分支以及设置要推出的用户百分比。要增加或减少转出量,请再次运行该命令并选择 Edit
选项来调整转出百分比。
¥In the terminal, an interactive guide will assist you in selecting a channel, choosing a branch for the rollout, and setting the percentage of users for the rollout. To increase or decrease the rollout amount, run the command again and choose the Edit
option to adjust the rollout percentage.
¥Ending a rollout
当你在交互式指南中选择 End
选项时,有两种方法可以结束推出:
¥Two methods are available to end a rollout when you choose the End
option in the interactive guide:
重新发布并恢复:当你对新分支的状态有信心时,请使用此选项。这会将最新更新从新分支重新发布到旧分支,并且所有用户都将被指向旧分支。
¥Republish and revert: Use this option when you are confident with the state of the new branch. This will republish the latest update from the new branch to the old branch, and all users will be pointed to the old branch.
恢复:选择忽略新分支上的更新并将用户返回到旧分支。
¥Revert: Choose to disregard the updates on the new branch and return users to the old branch.
¥Working with rollouts
一个通道上一次只能推出一个分支。
¥Only one branch can be rolled out on a channel at a single time.
要查看推出的状态,请使用 eas channel:rollout
命令。
¥To see the state of the rollout, use the eas channel:rollout
command.
例如,当部署正在进行时,你可以通过运行 eas update --branch [branch]
将更新发布到已部署分支和当前分支。
¥When a rollout is in progress, you can publish updates to both rolled out and current branches by running eas update --branch [branch]
, for example.
eas update --channel [channel]
无法在部署过程中使用,因为它无法知道将更新与部署中的哪个分支关联。
¥eas update --channel [channel]
cannot be used when a rollout is in progress since it cannot know which branch in the rollout to associate the update with.