offline_signing: add command to start rolling an update

Reduce the group update rate to 3/minute on amd64-usr only, then update
the channel version.
This commit is contained in:
Benjamin Gilbert 2017-09-06 15:16:50 -07:00
parent b372c56d6d
commit 716b081cdf

View File

@ -6,6 +6,11 @@ declare -A APPID
APPID[amd64-usr]=e96281a6-d1af-4bde-9a0a-97b76e56dc57 APPID[amd64-usr]=e96281a6-d1af-4bde-9a0a-97b76e56dc57
APPID[arm64-usr]=103867da-e3a2-4c92-b0b3-7fbd7f7d8b71 APPID[arm64-usr]=103867da-e3a2-4c92-b0b3-7fbd7f7d8b71
declare -A RELEASE_CHANNEL
RELEASE_CHANNEL[alpha]=Alpha
RELEASE_CHANNEL[beta]=Beta
RELEASE_CHANNEL[stable]=Stable
download() { download() {
local channel="$1" local channel="$1"
local version="$2" local version="$2"
@ -64,20 +69,50 @@ upload() {
fi fi
} }
roll() {
local channel="$1"
local version="$2"
local board="$3"
# Only ramp rollouts on AMD64; ARM64 is too small
if [[ "$board" = "amd64-usr" ]]; then
updateservicectl \
--server="https://public.update.core-os.net" \
--user="${ROLLER_USERNAME}" \
--key="${ROLLER_API_KEY}" \
group update \
--app-id="${APPID[${board}]}" \
--group-id="${channel}" \
--update-count=3 \
--update-interval=60
fi
# FIXME(bgilbert): We set --publish=true because there's no way to
# say --publish=unchanged
updateservicectl \
--server="https://public.update.core-os.net" \
--user="${ROLLER_USERNAME}" \
--key="${ROLLER_API_KEY}" \
channel update \
--app-id="${APPID[${board}]}" \
--channel="${RELEASE_CHANNEL[${channel}]}" \
--publish=true \
--version="${version}"
}
usage() { usage() {
echo "Usage: $0 {download|upload} <ARTIFACT-DIR> [{-a|-b|-s} <VERSION>]..." >&2 echo "Usage: $0 {download|upload} <ARTIFACT-DIR> [{-a|-b|-s} <VERSION>]..." >&2
echo "Usage: $0 roll [{-a|-b|-s} <VERSION>]..." >&2
exit 1 exit 1
} }
# Parse base arguments. # Parse subcommand.
CMD="${1:-}" CMD="${1:-}"
BASEDIR="${2:-}" shift ||:
shift 2 ||:
case "${CMD}" in case "${CMD}" in
download) download)
;; ;;
upload) upload|roll)
if [[ -e "${HOME}/.config/roller.conf" ]]; then if [[ -e "${HOME}/.config/roller.conf" ]]; then
. "${HOME}/.config/roller.conf" . "${HOME}/.config/roller.conf"
fi fi
@ -92,14 +127,21 @@ case "${CMD}" in
;; ;;
esac esac
if [[ -z "${BASEDIR}" ]]; then # Parse basedir if necessary.
case "${CMD}" in
download|upload)
BASEDIR="${1:-}"
shift ||:
if [[ -z "${BASEDIR}" ]]; then
usage usage
fi fi
if [[ -d "${BASEDIR}" && ! -O "${BASEDIR}" ]]; then if [[ -d "${BASEDIR}" && ! -O "${BASEDIR}" ]]; then
echo "Fixing ownership of ${BASEDIR}..." echo "Fixing ownership of ${BASEDIR}..."
sudo chown -R "${USER}" "${BASEDIR}" sudo chown -R "${USER}" "${BASEDIR}"
fi fi
;;
esac
# Walk argument pairs. # Walk argument pairs.
while [[ $# > 0 ]]; do while [[ $# > 0 ]]; do