From cac3d1fca102514d5ce8230d03652eefbf4b7c0b Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 25 Oct 2016 21:37:16 -0400 Subject: remove static node, add singlenode, put repeated things into deploy function --- bin/lut.sh | 65 ++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/bin/lut.sh b/bin/lut.sh index d014881..df6a006 100755 --- a/bin/lut.sh +++ b/bin/lut.sh @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/bash -x # This script lives in the lut provider and should be run from there provider_dir=`pwd` @@ -6,6 +6,7 @@ platform_git=https://leap.se/git/leap_platform cli_git=https://leap.se/git/leap_cli from_version=$1 to_version=$2 + #workdir=`mktemp -d` workdir='/tmp/lut' platform_link="${workdir}/leap_platform" @@ -56,9 +57,19 @@ get_platform () { } get_cli () { - cli_dir=${workdir}/cli_$2 + # note: the following is an ugly way to set the cli version it is based on + # the fact that the second number in the platform version is the second + # number of the cli version, with a prepended 1. For example, if the + # platform version in 0.8.2, then the cli version is 1.8. + version=$2 + if [ "$version" == 'develop' ]; then + cli_version='develop' + else + cli_version=1.${version:2:1} + fi + cli_dir=${workdir}/cli_${cli_version} echo "Setup leap_cli" - git clone $cli_git $cli_dir --branch $2 + git clone $cli_git $cli_dir --branch $cli_version cd $cli_dir rake build bundle --path vendor/bundle @@ -71,7 +82,7 @@ switch () { cleanup () { # leap vm stop upgrade - rm -rf $workdir +# rm -rf $workdir exit $1 } @@ -84,10 +95,22 @@ start_nodes () { # hairstreak: mx leap vm add hairstreak # checkerspot: openvn, need a gateway address to do openvpn, disabled - # spicebush: static node, with hidden service - leap vm add spicebush + # spicebush: static node, with hidden service, disabled because static service is not tested + # leap vm add spicebush # cloak: tor exit leap vm add cloak + # swallowtail: singlenode + leap vm add swallowtail +} + +deploy () { + $1/bin/leap -v2 --yes deploy $2 + + if [ $? -ne 0 ]; then + cleanup 1 + else + echo "$2 environment deployed with old version of platform" + fi } case "$1" in @@ -100,12 +123,14 @@ esac if [ $# -ne 2 ]; then help else + leap vm rm upgrade + rm -rf $workdir check_version $platform_git $from_version check_version $platform_git $to_version get_platform $platform_git $from_version get_platform $platform_git $to_version - get_cli $cli_git master - get_cli $cli_git develop + get_cli $cli_git $from_version + get_cli $cli_git $to_version cd $provider_dir switch $to_version start_nodes @@ -117,27 +142,25 @@ else if [ $? -ne 0 ]; then cleanup 1 else - echo "Nodes initialized with old platform" + echo "Multi-node environment initialized with old platform" fi - # 0.8 hack, remove after 0.9 release - switch $from_version - $cli_from/bin/leap -v2 --yes deploy upgrade - + $cli_to/bin/leap -v2 node init singlenode if [ $? -ne 0 ]; then cleanup 1 else - echo "Nodes deployed with old version of platform" + echo "Single-node environment initialized with old platform" fi + + # 0.8 hack, remove after 0.9 release + switch $from_version + deploy $cli_from upgrade + deploy $cli_from singlenode $cli_from/bin/leap test - switch $to_version - $cli_to/bin/leap -v2 --yes deploy upgrade - if [ $? -ne 0 ]; then - cleanup 1 - else - echo "Nodes deployed with new version of platform" - fi + switch $to_version + deploy $cli_to upgrade + deploy $cli_to singlenode $cli_to/bin/leap test cleanup 0 -- cgit v1.2.3