-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathscript
More file actions
executable file
·94 lines (64 loc) · 2.37 KB
/
script
File metadata and controls
executable file
·94 lines (64 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env bash
# To implement this command, edit the "Command implementation" section below.
# Usage
# -----
# Comments prefixed with `#/` are managed by stubbs.
# The `command` and `usage` comments describe the command
# and show its options.
#
#/ command: accept:upgrade: "Tests upgrade path for Deis"
#/ usage: rerun accept:upgrade --provider <vagrant> --from <> [ --to <master>] [ --skip-cleanup <false>] --upgrade-style <graceful>
# Load common functions
# ---------------------
# Load the function library for this module.
# This loads rerun functions, too.
. $RERUN_MODULE_DIR/lib/functions.sh upgrade || {
echo >&2 "Failed loading function library." ; exit 1 ;
}
# Error handling
# ---------------
# This script is designed to _fail-fast_.
# Trap errors and exit. The call to `rerun_die` will print the
# the error message and exit with the error command exit status.
trap 'rerun_die $? "*** command failed: tests:upgrade. ***"' ERR
# Run [set] `nounset` to treat unset variables as errors. Set [pipefail]
# so a pipeline return status is the value of the last
# (rightmost) command to exit with non-zero status.
#
# [set]: http://ss64.com/bash/set.html
# [pipefail]: http://www.gnu.org/software/bash/manual/html_node/Pipelines.html
set -o nounset -o pipefail
# Command variables
# -----------------
# This command script can access the following variables
# declared by `rerun` or by the option parser function.
#/ rerun-variables: RERUN, RERUN_VERSION, RERUN_MODULES, RERUN_MODULE_DIR
#/ option-variables: PROVIDER FROM TO SKIP_CLEANUP UPGRADE_STYLE
# The `rerun_options_parse` function processes the command line
# arguments. Each accepted command line flag results in setting
# one the corresponding option variables.
rerun_options_parse "$@"
trap destroy-cluster EXIT
# Command implementation
# ----------------------
function healthcheck {
rerun_log "Running healthcheck of previously deployed app.."
if ! curl -s "http://testing.${DEIS_TEST_DOMAIN}" | grep -q "Powered by Deis"; then
rerun_log error "Failed to pass healthcheck."
return 1
else
rerun_log info "Healthcheck succeeded."
return 0
fi
}
setup-provider "${PROVIDER}"
setup-upgrader "${UPGRADE_STYLE}"
setup-provider-dependencies
destroy-cluster
setup-clients "${FROM}"
make discovery-url
create-cluster
deploy-deis "${FROM}"
make test-smoke
upgrade-deis "${FROM}" "${TO}"
healthcheck