From 2f1b0bf4f5129f78d9805c773c5c63462fac0e98 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Wed, 10 Apr 2019 16:46:30 -0700 Subject: [PATCH] Add solana-install deployments to the testnets --- ci/testnet-deploy.sh | 15 ++++++++-- net/net.sh | 47 ++++++++++++++++++++++++++++-- net/remote/remote-deploy-update.sh | 36 +++++++++++++++++++++++ 3 files changed, 93 insertions(+), 5 deletions(-) create mode 100755 net/remote/remote-deploy-update.sh diff --git a/ci/testnet-deploy.sh b/ci/testnet-deploy.sh index b8c07a8fd..5ef74ce3b 100755 --- a/ci/testnet-deploy.sh +++ b/ci/testnet-deploy.sh @@ -257,9 +257,20 @@ if ! $skipStart; then op=start fi - # shellcheck disable=SC2086 # Don't want to double quote maybeRejectExtraNodes + maybeUpdateManifestKeypairFile= + # shellcheck disable=SC2154 # SOLANA_INSTALL_UPDATE_MANIFEST_KEYPAIR_x86_64_unknown_linux_gnu comes from .buildkite/env/ + if [[ -n $SOLANA_INSTALL_UPDATE_MANIFEST_KEYPAIR_x86_64_unknown_linux_gnu ]]; then + echo "$SOLANA_INSTALL_UPDATE_MANIFEST_KEYPAIR_x86_64_unknown_linux_gnu" > update_manifest_keypair.json + maybeUpdateManifestKeypairFile="-i update_manifest_keypair.json" + fi + + # shellcheck disable=SC2086 # Don't want to double quote the $maybeXYZ variables time net/net.sh $op -t "$tarChannelOrTag" \ - $maybeSkipSetup $maybeRejectExtraNodes $maybeNoValidatorSanity $maybeNoLedgerVerify + $maybeUpdateManifestKeypairFile \ + $maybeSkipSetup \ + $maybeRejectExtraNodes \ + $maybeNoValidatorSanity \ + $maybeNoLedgerVerify ) || ok=false net/net.sh logs diff --git a/net/net.sh b/net/net.sh index c7047f628..6a25c06a2 100755 --- a/net/net.sh +++ b/net/net.sh @@ -30,6 +30,8 @@ Operate a configured testnet -t edge|beta|stable|vX.Y.Z - Deploy the latest tarball release for the specified release channel (edge|beta|stable) or release tag (vX.Y.Z) + -i update_manifest_keypair - Deploy the tarball using 'solana-install deploy ...' + (-t option must be supplied as well) -f [cargoFeatures] - List of |cargo --feaures=| to activate (ignored if -s or -S is specified) -r - Reuse existing node/ledger configuration from a @@ -60,12 +62,14 @@ cargoFeatures= skipSetup=false updateNodes=false customPrograms= +updateManifestKeypairFile= +updateDownloadUrl= command=$1 [[ -n $command ]] || usage shift -while getopts "h?T:t:o:f:r:D:" opt; do +while getopts "h?T:t:o:f:r:D:i:" opt; do case $opt in h | \?) usage @@ -89,6 +93,13 @@ while getopts "h?T:t:o:f:r:D:" opt; do f) cargoFeatures=$OPTARG ;; + i) + updateManifestKeypairFile=$OPTARG + if [[ ! -r $updateManifestKeypairFile ]]; then + echo "Error: unable to read the file $updateManifestKeypairFile" + exit 1 + fi + ;; r) skipSetup=true ;; @@ -285,17 +296,45 @@ sanity() { $metricsWriteDatapoint "testnet-deploy net-sanity-complete=1" } +deployUpdate() { + if [[ -z $updateManifestKeypairFile ]]; then + return + fi + [[ $deployMethod = tar ]] || exit 1 + [[ -n $updateDownloadUrl ]] || exit 1 + + declare ok=true + declare bootstrapLeader=${fullnodeIpList[0]} + + echo "--- Deploying solana-install update: $updateDownloadUrl" + ( + set -x + timeout 30s scp "${sshOptions[@]}" \ + "$updateManifestKeypairFile" "$bootstrapLeader:solana/update_manifest_keypair.json" + + # shellcheck disable=SC2029 # remote-deploy-update.sh args are expanded on client side intentionally + ssh "${sshOptions[@]}" "$bootstrapLeader" \ + "./solana/net/remote/remote-deploy-update.sh $updateDownloadUrl \"$RUST_LOG\"" + ) || ok=false + $ok || exit 1 +} + start() { case $deployMethod in tar) if [[ -n $releaseChannel ]]; then rm -f "$SOLANA_ROOT"/solana-release.tar.bz2 + updateDownloadUrl=http://solana-release.s3.amazonaws.com/"$releaseChannel"/solana-release-x86_64-unknown-linux-gnu.tar.bz2 ( set -x - curl -o "$SOLANA_ROOT"/solana-release.tar.bz2 \ - http://solana-release.s3.amazonaws.com/"$releaseChannel"/solana-release-x86_64-unknown-linux-gnu.tar.bz2 + curl -o "$SOLANA_ROOT"/solana-release.tar.bz2 "$updateDownloadUrl" ) tarballFilename="$SOLANA_ROOT"/solana-release.tar.bz2 + else + if [[ -n $updateManifestKeypairFile ]]; then + echo "Error: -i argument was provided but -t was not" + exit 1 + fi fi ( set -x @@ -401,6 +440,8 @@ start() { esac $metricsWriteDatapoint "testnet-deploy version=\"${networkVersion:0:9}\"" + deployUpdate + echo echo "+++ Deployment Successful" echo "Bootstrap leader deployment took $bootstrapNodeDeployTime seconds" diff --git a/net/remote/remote-deploy-update.sh b/net/remote/remote-deploy-update.sh new file mode 100755 index 000000000..f69e84338 --- /dev/null +++ b/net/remote/remote-deploy-update.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +set -e +# +# This script is to be run on the bootstrap full node +# + +cd "$(dirname "$0")"/../.. + +updateDownloadUrl=$1 + +[[ -r deployConfig ]] || { + echo deployConfig missing + exit 1 +} +# shellcheck source=/dev/null # deployConfig is written by remote-node.sh +source deployConfig + +missing() { + echo "Error: $1 not specified" + exit 1 +} + +[[ -n $updateDownloadUrl ]] || missing updateDownloadUrl + +RUST_LOG="$2" +export RUST_LOG=${RUST_LOG:-solana=info} # if RUST_LOG is unset, default to info + +source net/common.sh +loadConfigFile + +PATH="$HOME"/.cargo/bin:"$PATH" + +set -x +solana-wallet airdrop 42 +solana-install deploy "$updateDownloadUrl" update_manifest_keypair.json \ + --url http://localhost:8899