Extract common code from site scripts
[icn.git] / deploy / site / vm-mc / vm-mc.sh
1 #!/usr/bin/env bash
2 set -eux -o pipefail
3
4 SCRIPTDIR="$(readlink -f $(dirname ${BASH_SOURCE[0]}))"
5 LIBDIR="$(dirname $(dirname $(dirname ${SCRIPTDIR})))/env/lib"
6
7 source $LIBDIR/common.sh
8 source $SCRIPTDIR/../common.sh
9
10 BUILDDIR=${SCRIPTDIR/deploy/build}
11 mkdir -p ${BUILDDIR}
12
13 SITE_REPO=${SITE_REPO:-" https://gerrit.akraino.org/r/icn"}
14 SITE_BRANCH=${SITE_BRANCH:-"master"}
15 SITE_PATH=${SITE_PATH:-"deploy/site/vm-mc/deployment"}
16
17 case $1 in
18     "clean") site_clean ;;
19     "deploy")
20         gpg --import ${FLUX_SOPS_PRIVATE_KEY}
21         site_deploy
22         ;;
23     "wait")
24         site_wait_for_all_ready
25         site_insert_control_plane_network_identity_into_ssh_config
26         ;;
27     "wait-clean") site_wait_for_all_deleted ;;
28     *) cat <<EOF
29 Usage: $(basename $0) COMMAND
30
31 Commands:
32   clean         - Remove the site
33   deploy        - Deploy the site
34   wait          - Wait for the site to be ready
35   wait-clean    - Wait for the site to be removed
36 EOF
37        ;;
38 esac