Add solana-install deployments to the testnets

This commit is contained in:
Michael Vines 2019-04-10 16:46:30 -07:00
parent e1d5bb1a26
commit 2f1b0bf4f5
3 changed files with 93 additions and 5 deletions

View File

@ -257,9 +257,20 @@ if ! $skipStart; then
op=start op=start
fi 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" \ time net/net.sh $op -t "$tarChannelOrTag" \
$maybeSkipSetup $maybeRejectExtraNodes $maybeNoValidatorSanity $maybeNoLedgerVerify $maybeUpdateManifestKeypairFile \
$maybeSkipSetup \
$maybeRejectExtraNodes \
$maybeNoValidatorSanity \
$maybeNoLedgerVerify
) || ok=false ) || ok=false
net/net.sh logs net/net.sh logs

View File

@ -30,6 +30,8 @@ Operate a configured testnet
-t edge|beta|stable|vX.Y.Z - Deploy the latest tarball release for the -t edge|beta|stable|vX.Y.Z - Deploy the latest tarball release for the
specified release channel (edge|beta|stable) or release tag specified release channel (edge|beta|stable) or release tag
(vX.Y.Z) (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 -f [cargoFeatures] - List of |cargo --feaures=| to activate
(ignored if -s or -S is specified) (ignored if -s or -S is specified)
-r - Reuse existing node/ledger configuration from a -r - Reuse existing node/ledger configuration from a
@ -60,12 +62,14 @@ cargoFeatures=
skipSetup=false skipSetup=false
updateNodes=false updateNodes=false
customPrograms= customPrograms=
updateManifestKeypairFile=
updateDownloadUrl=
command=$1 command=$1
[[ -n $command ]] || usage [[ -n $command ]] || usage
shift 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 case $opt in
h | \?) h | \?)
usage usage
@ -89,6 +93,13 @@ while getopts "h?T:t:o:f:r:D:" opt; do
f) f)
cargoFeatures=$OPTARG cargoFeatures=$OPTARG
;; ;;
i)
updateManifestKeypairFile=$OPTARG
if [[ ! -r $updateManifestKeypairFile ]]; then
echo "Error: unable to read the file $updateManifestKeypairFile"
exit 1
fi
;;
r) r)
skipSetup=true skipSetup=true
;; ;;
@ -285,17 +296,45 @@ sanity() {
$metricsWriteDatapoint "testnet-deploy net-sanity-complete=1" $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() { start() {
case $deployMethod in case $deployMethod in
tar) tar)
if [[ -n $releaseChannel ]]; then if [[ -n $releaseChannel ]]; then
rm -f "$SOLANA_ROOT"/solana-release.tar.bz2 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 set -x
curl -o "$SOLANA_ROOT"/solana-release.tar.bz2 \ curl -o "$SOLANA_ROOT"/solana-release.tar.bz2 "$updateDownloadUrl"
http://solana-release.s3.amazonaws.com/"$releaseChannel"/solana-release-x86_64-unknown-linux-gnu.tar.bz2
) )
tarballFilename="$SOLANA_ROOT"/solana-release.tar.bz2 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 fi
( (
set -x set -x
@ -401,6 +440,8 @@ start() {
esac esac
$metricsWriteDatapoint "testnet-deploy version=\"${networkVersion:0:9}\"" $metricsWriteDatapoint "testnet-deploy version=\"${networkVersion:0:9}\""
deployUpdate
echo echo
echo "+++ Deployment Successful" echo "+++ Deployment Successful"
echo "Bootstrap leader deployment took $bootstrapNodeDeployTime seconds" echo "Bootstrap leader deployment took $bootstrapNodeDeployTime seconds"

View File

@ -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