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

View File

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

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