From 32f3d4165bd012bb0d940797b0cee21d0c06d3ab Mon Sep 17 00:00:00 2001 From: Stephen Demos Date: Tue, 19 Jun 2018 13:45:47 -0700 Subject: [PATCH 1/2] transfer.sh: use new group percent subcommand updateservicectl removed the update-percent flag from group update to force users to use the new api. update percents are now modified using the group percent command. --- offline_signing/transfer.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/offline_signing/transfer.sh b/offline_signing/transfer.sh index b68751b13c..3cbc300224 100755 --- a/offline_signing/transfer.sh +++ b/offline_signing/transfer.sh @@ -105,18 +105,17 @@ roll() { --server="https://public.update.core-os.net" \ --user="${ROLLER_USERNAME}" \ --key="${ROLLER_API_KEY}" \ - group update \ + group percent \ --app-id="${APPID[${board}]}" \ --group-id="${channel}" \ --update-percent=100 else - # TODO(sdemos): update this behavior when rollout strategies land in roller echo "Rollout set to 0%" updateservicectl \ --server="https://public.update.core-os.net" \ --user="${ROLLER_USERNAME}" \ --key="${ROLLER_API_KEY}" \ - group update \ + group percent \ --app-id="${APPID[${board}]}" \ --group-id="${channel}" \ --update-percent=0 From 495d335ed479c6079bc04ca03b41c4a5fd3e5fbc Mon Sep 17 00:00:00 2001 From: Stephen Demos Date: Tue, 19 Jun 2018 13:47:10 -0700 Subject: [PATCH 2/2] transfer.sh: new ready/roll command series the ready command prepares the specified groups for the rollout - it sets the channel to the new version and updates the update percent to 0%. this allows machines to force update, but updates don't get rolled out automatically. the roll command configures the rollout strategy. right now it creates a linear rollout, going from 0% to 100% in the given number of hours for each group. it uses the default frame size of 60 seconds (it sets it to be explicit). --- offline_signing/transfer.sh | 76 ++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/offline_signing/transfer.sh b/offline_signing/transfer.sh index 3cbc300224..4f4f97bf6d 100755 --- a/offline_signing/transfer.sh +++ b/offline_signing/transfer.sh @@ -93,33 +93,22 @@ upload() { fi } -roll() { +ready() { local channel="$1" local version="$2" local board="$3" - # Only ramp rollouts on AMD64; ARM64 is too small - if [[ "$board" = "arm64-usr" ]]; then - echo "Setting rollout for arm64-usr to 100%" - updateservicectl \ - --server="https://public.update.core-os.net" \ - --user="${ROLLER_USERNAME}" \ - --key="${ROLLER_API_KEY}" \ - group percent \ - --app-id="${APPID[${board}]}" \ - --group-id="${channel}" \ - --update-percent=100 - else - echo "Rollout set to 0%" - updateservicectl \ - --server="https://public.update.core-os.net" \ - --user="${ROLLER_USERNAME}" \ - --key="${ROLLER_API_KEY}" \ - group percent \ - --app-id="${APPID[${board}]}" \ - --group-id="${channel}" \ - --update-percent=0 - fi + # setting the percent will deactivate (not delete) any existing rollouts for + # this specific group. + echo "Rollout set to 0% for ${board}" + updateservicectl \ + --server="https://public.update.core-os.net" \ + --user="${ROLLER_USERNAME}" \ + --key="${ROLLER_API_KEY}" \ + group percent \ + --app-id="${APPID[${board}]}" \ + --group-id="${channel}" \ + --update-percent=0 # FIXME(bgilbert): We set --publish=true because there's no way to # say --publish=unchanged @@ -134,9 +123,44 @@ roll() { --version="${version}" } +roll() { + local channel="$1" + local hours="$2" + local board="$3" + + local seconds=$((${hours} * 3600)) + + # Only ramp rollouts on AMD64; ARM64 is too small + if [[ "$board" = "arm64-usr" ]]; then + echo "Setting rollout for arm64-usr to 100%" + updateservicectl \ + --server="https://public.update.core-os.net" \ + --user="${ROLLER_USERNAME}" \ + --key="${ROLLER_API_KEY}" \ + group percent \ + --app-id="${APPID[${board}]}" \ + --group-id="${channel}" \ + --update-percent=100 + else + # creating a new rollout deletes any existing rollout for this group and + # automatically activates the new one. + echo "Creating linear rollout for ${board} that will get to 100% in ${hours}h" + updateservicectl \ + --server="https://public.update.core-os.net" \ + --user="${ROLLER_USERNAME}" \ + --key="${ROLLER_API_KEY}" \ + rollout create linear \ + --app-id="${APPID[${board}]}" \ + --group-id="${channel}" \ + --duration="${seconds}" \ + --frame-size="60" + fi +} + usage() { echo "Usage: $0 {download|upload} [{-a|-b|-s} ]..." >&2 - echo "Usage: $0 roll [{-a|-b|-s} ]..." >&2 + echo "Usage: $0 ready [{-a|-b|-s} ]..." >&2 + echo "Usage: $0 roll [{-a|-b|-s} ]..." >&2 exit 1 } @@ -146,7 +170,7 @@ shift ||: case "${CMD}" in download) ;; - upload|roll) + upload|ready|roll) if [[ -e "${HOME}/.config/roller.conf" ]]; then . "${HOME}/.config/roller.conf" fi @@ -180,7 +204,7 @@ esac # Walk argument pairs. while [[ $# > 0 ]]; do c="$1" - v="${2?Must provide a version (e.g. 1234.0.0)}" + v="${2?Must provide an argument for each channel (see usage)}" shift 2 case "${c}" in