From 733a206a956f41e77a18382296b131fcfd94a5ec Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Wed, 6 Sep 2017 14:48:53 -0700 Subject: [PATCH 1/4] offline_signing: update version in canary channel after upload if a canary channel is specified. --- offline_signing/transfer.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/offline_signing/transfer.sh b/offline_signing/transfer.sh index 7a3ab7cc4e..9892a8eefa 100755 --- a/offline_signing/transfer.sh +++ b/offline_signing/transfer.sh @@ -49,6 +49,19 @@ upload() { --board="${board}" \ --version="${version}" \ --payload="${payload}" + + # Update version in a canary channel if one is defined. + local -n canary_channel="ROLLER_CANARY_CHANNEL_${channel^^}" + if [[ -n "${canary_channel}" ]]; then + updateservicectl \ + --server="https://public.update.core-os.net" \ + --user="${ROLLER_USERNAME}" \ + --key="${ROLLER_API_KEY}" \ + channel update \ + --app-id="${appid[${board}]}" \ + --channel="${canary_channel}" \ + --version="${version}" + fi } usage() { From b372c56d6dddcec718f90b2fe75e607f1c03f66b Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Wed, 6 Sep 2017 14:49:50 -0700 Subject: [PATCH 2/4] offline_signing: make appid array global --- offline_signing/transfer.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/offline_signing/transfer.sh b/offline_signing/transfer.sh index 9892a8eefa..6356e9ae69 100755 --- a/offline_signing/transfer.sh +++ b/offline_signing/transfer.sh @@ -2,6 +2,10 @@ set -eux +declare -A APPID +APPID[amd64-usr]=e96281a6-d1af-4bde-9a0a-97b76e56dc57 +APPID[arm64-usr]=103867da-e3a2-4c92-b0b3-7fbd7f7d8b71 + download() { local channel="$1" local version="$2" @@ -38,14 +42,10 @@ upload() { exit 1 fi - declare -A appid - appid[amd64-usr]=e96281a6-d1af-4bde-9a0a-97b76e56dc57 - appid[arm64-usr]=103867da-e3a2-4c92-b0b3-7fbd7f7d8b71 - "$(dirname $0)/../core_roller_upload" \ --user="${ROLLER_USERNAME}" \ --api_key="${ROLLER_API_KEY}" \ - --app_id="${appid[${board}]}" \ + --app_id="${APPID[${board}]}" \ --board="${board}" \ --version="${version}" \ --payload="${payload}" @@ -58,7 +58,7 @@ upload() { --user="${ROLLER_USERNAME}" \ --key="${ROLLER_API_KEY}" \ channel update \ - --app-id="${appid[${board}]}" \ + --app-id="${APPID[${board}]}" \ --channel="${canary_channel}" \ --version="${version}" fi From 716b081cdf03826a58d33cbb94059e3978490050 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Wed, 6 Sep 2017 15:16:50 -0700 Subject: [PATCH 3/4] 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. --- offline_signing/transfer.sh | 66 ++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/offline_signing/transfer.sh b/offline_signing/transfer.sh index 6356e9ae69..b7f0487b6c 100755 --- a/offline_signing/transfer.sh +++ b/offline_signing/transfer.sh @@ -6,6 +6,11 @@ declare -A APPID APPID[amd64-usr]=e96281a6-d1af-4bde-9a0a-97b76e56dc57 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() { local channel="$1" local version="$2" @@ -64,20 +69,50 @@ upload() { 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() { echo "Usage: $0 {download|upload} [{-a|-b|-s} ]..." >&2 + echo "Usage: $0 roll [{-a|-b|-s} ]..." >&2 exit 1 } -# Parse base arguments. +# Parse subcommand. CMD="${1:-}" -BASEDIR="${2:-}" -shift 2 ||: - +shift ||: case "${CMD}" in download) ;; - upload) + upload|roll) if [[ -e "${HOME}/.config/roller.conf" ]]; then . "${HOME}/.config/roller.conf" fi @@ -92,14 +127,21 @@ case "${CMD}" in ;; esac -if [[ -z "${BASEDIR}" ]]; then - usage -fi +# Parse basedir if necessary. +case "${CMD}" in + download|upload) + BASEDIR="${1:-}" + shift ||: + if [[ -z "${BASEDIR}" ]]; then + usage + fi -if [[ -d "${BASEDIR}" && ! -O "${BASEDIR}" ]]; then - echo "Fixing ownership of ${BASEDIR}..." - sudo chown -R "${USER}" "${BASEDIR}" -fi + if [[ -d "${BASEDIR}" && ! -O "${BASEDIR}" ]]; then + echo "Fixing ownership of ${BASEDIR}..." + sudo chown -R "${USER}" "${BASEDIR}" + fi + ;; +esac # Walk argument pairs. while [[ $# > 0 ]]; do From 20eaa8a3711dcff177c97e4a10512b1c7d59b390 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Wed, 13 Sep 2017 16:07:44 -0700 Subject: [PATCH 4/4] offline_signing: download artifacts in parallel --- offline_signing/transfer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/offline_signing/transfer.sh b/offline_signing/transfer.sh index b7f0487b6c..d07b0f6986 100755 --- a/offline_signing/transfer.sh +++ b/offline_signing/transfer.sh @@ -21,7 +21,7 @@ download() { mkdir -p "${dir}" pushd "${dir}" >/dev/null - gsutil cp \ + gsutil -m cp \ "${gs}/coreos_production_image.vmlinuz" \ "${gs}/coreos_production_image.vmlinuz.sig" \ "${gs}/coreos_production_update.bin.bz2" \