From f5f5281f855b2ec2b8211c0ae1a9f3a57ca717b9 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Fri, 26 Apr 2019 10:02:23 -0600 Subject: [PATCH] Add on-demand functionality to all testnets (#4003) * Add on-demand functionality to all testnets --- ci/testnet-deploy.sh | 19 +++++- ci/testnet-manager.sh | 155 +++++++++++++++++++++++++++++++++++------- 2 files changed, 148 insertions(+), 26 deletions(-) diff --git a/ci/testnet-deploy.sh b/ci/testnet-deploy.sh index 5ef74ce3bc..281c1b5747 100755 --- a/ci/testnet-deploy.sh +++ b/ci/testnet-deploy.sh @@ -53,6 +53,9 @@ Deploys a CD testnet -D - Delete the network -r - Reuse existing node/ledger configuration from a previous |start| (ie, don't run ./multinode-demo/setup.sh). + -x - External node. Default: false + -s - Skip start. Nodes will still be created or configured, but network software will not be started. + -S - Stop network software without tearing down nodes. Note: the SOLANA_METRICS_CONFIG environment variable is used to configure metrics @@ -62,7 +65,7 @@ EOF zone=() -while getopts "h?p:Pn:c:t:gG:a:Dbd:rusxz:p:C:" opt; do +while getopts "h?p:Pn:c:t:gG:a:Dbd:rusxz:p:C:S" opt; do case $opt in h | \?) usage @@ -126,6 +129,9 @@ while getopts "h?p:Pn:c:t:gG:a:Dbd:rusxz:p:C:" opt; do u) blockstreamer=true ;; + S) + stopNetwork=true + ;; *) usage "Error: unhandled option: $opt" ;; @@ -162,6 +168,11 @@ for val in "${zone[@]}"; do zone_args+=("-z $val") done +if $stopNetwork; then + skipSetup=true +fi + +# Create the network if ! $skipSetup; then echo "--- $cloudProvider.sh delete" # shellcheck disable=SC2068 @@ -227,6 +238,12 @@ net/init-metrics.sh -e echo "+++ $cloudProvider.sh info" net/"$cloudProvider".sh info +if $stopNetwork; then + echo --- net.sh stop + time net/net.sh stop + exit 0 +fi + echo --- net.sh start maybeRejectExtraNodes= if ! $publicNetwork; then diff --git a/ci/testnet-manager.sh b/ci/testnet-manager.sh index b3aa35369c..2b9e1bfd72 100755 --- a/ci/testnet-manager.sh +++ b/ci/testnet-manager.sh @@ -42,20 +42,28 @@ steps: value: "testnet-beta" - label: "testnet-beta-perf" value: "testnet-beta-perf" + - label: "testnet-demo" + value: "testnet-demo" - select: "Operation" key: "testnet-operation" default: "sanity-or-restart" options: - - label: "Sanity check. Restart network on failure" - value: "sanity-or-restart" - - label: "Start (or restart) the network" + - label: "Create new testnet nodes and then start network software. If nodes are already created, they will be deleted and then re-created." + value: "create-and-start" + - label: "Create new testnet nodes, but do not start network software. If nodes are already created, they will be deleted and then re-created." + value: "create" + - label: "Start network software on already-created testnet nodes. If software is already running, it will be restarted." value: "start" - - label: "Update the network software. Restart network on failure" - value: "update-or-restart" - - label: "Stop the network" + - label: "Stop network software without deleting testnet nodes" value: "stop" + - label: "Update the network software. Restart network software on failure" + value: "update-or-restart" + - label: "Sanity check. Restart network software on failure" + value: "sanity-or-restart" - label: "Sanity check only" value: "sanity" + - label: "Delete all nodes on a testnet. Network software will be stopped first if it is running" + value: "delete" - command: "ci/$(basename "$0")" agents: - "queue=$BUILDKITE_AGENT_META_DATA_QUEUE" @@ -88,6 +96,10 @@ testnet|testnet-perf) CHANNEL_BRANCH=$STABLE_CHANNEL : "${TESTNET_DB_HOST:=https://clocktower-f1d56615.influxcloud.net:8086}" ;; +testnet-demo) + CHANNEL_OR_TAG=beta + CHANNEL_BRANCH=$BETA_CHANNEL + ;; *) echo "Error: Invalid TESTNET=$TESTNET" exit 1 @@ -105,6 +117,7 @@ source scripts/configure-metrics.sh if [[ -n $TESTNET_TAG ]]; then CHANNEL_OR_TAG=$TESTNET_TAG else + if [[ $BUILDKITE_BRANCH != "$CHANNEL_BRANCH" ]]; then ( cat <