github.com/rochacon/deis@v1.0.2-0.20150903015341-6839b592a1ff/tests/bin/accept/commands/provision/script (about) 1 #!/usr/bin/env bash 2 3 # To implement this command, edit the "Command implementation" section below. 4 5 # Usage 6 # ----- 7 8 # Comments prefixed with `#/` are managed by stubbs. 9 # The `command` and `usage` comments describe the command 10 # and show its options. 11 # 12 #/ command: tests:provision: "Provision a cluster" 13 #/ usage: rerun tests:provision --provider <vagrant> --version <dev> [ --skip-cleanup <false>] 14 15 # Load common functions 16 # --------------------- 17 18 # Load the function library for this module. 19 # This loads rerun functions, too. 20 . $RERUN_MODULE_DIR/lib/functions.sh provision || { 21 echo >&2 "Failed loading function library." ; exit 1 ; 22 } 23 24 # Error handling 25 # --------------- 26 27 # This script is designed to _fail-fast_. 28 29 # Trap errors and exit. The call to `rerun_die` will print the 30 # the error message and exit with the error command exit status. 31 32 trap 'rerun_die $? "*** command failed: tests:provision. ***"' ERR 33 34 # Run [set] `nounset` to treat unset variables as errors. Set [pipefail] 35 # so a pipeline return status is the value of the last 36 # (rightmost) command to exit with non-zero status. 37 # 38 # [set]: http://ss64.com/bash/set.html 39 # [pipefail]: http://www.gnu.org/software/bash/manual/html_node/Pipelines.html 40 41 set -o nounset -o pipefail 42 43 # Command variables 44 # ----------------- 45 46 # This command script can access the following variables 47 # declared by `rerun` or by the option parser function. 48 49 #/ rerun-variables: RERUN, RERUN_VERSION, RERUN_MODULES, RERUN_MODULE_DIR 50 #/ option-variables: PROVIDER VERSION SKIP_CLEANUP 51 52 # The `rerun_options_parse` function processes the command line 53 # arguments. Each accepted command line flag results in setting 54 # one the corresponding option variables. 55 56 rerun_options_parse "$@" 57 58 trap destroy-cluster EXIT 59 60 # Command implementation 61 # ---------------------- 62 63 TEST_ROOT="${TEST_ROOT}/${VERSION}" 64 65 setup-provider "${PROVIDER}" 66 67 setup-provider-dependencies 68 69 destroy-cluster 70 71 setup-clients "${VERSION}" 72 73 make discovery-url 74 75 create-cluster 76 77 build-deis "${VERSION}" 78 79 deploy-deis "${VERSION}" 80 81 make test-smoke