forked from openstack-archive/tripleo-quickstart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devmode.sh
executable file
·206 lines (177 loc) · 5.79 KB
/
devmode.sh
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#!/bin/bash
: ${GATE:=1}
: ${WORKSPACE:=$HOME/.quickstart}
: ${RELEASE:=master-tripleo-ci}
: ${CONFIG:=minimal}
: ${BUILD_SYS:=delorean}
: ${DEPLOY_TYPE:=libvirt}
: ${ENVIRONMENT:=rdocloud}
: ${CUSTOM_REQUIREMENTS_INSTALL:=none}
: ${DELETE_ALL_STACKS:=false}
interactive=0
reproducer_type=gerrit
usage () {
echo "Usage: $0 [options] virthost"
echo ""
echo "Options:"
echo " -c, --config <type> Only minimal.yml config is supported and tested."
echo " specify the node configuration (default=$CONFIG)"
echo " -n, --no-gate do not ask for gating a commit when gating"
echo " variables are missing (default is gating)"
echo " -w, --working-dir <dir>"
echo " directory where the virtualenv, inventory files, etc."
echo " are created (default=$WORKSPACE)"
echo " -d, --delete-all-stacks"
echo " delete all stacks in the tenant before deployment."
echo " will also delete associated keypairs if they exist."
echo " -r, --release <release>"
echo " OpenStack release to deploy (default=$RELEASE)."
echo " -h, --help print this help and exit. Note OVB is no longer supported.
See https://docs.openstack.org/tripleo-docs/latest/contributor/reproduce-ci.html"
echo " virthost target machine used for deployment, required argument"
}
zuul-gate () {
if [[ -z "$ZUUL_HOST" ]]; then
interactive=1
echo "Which Zuul host to use? (default=review.opendev.org)"
read -p "ZUUL_HOST=" ZUUL_HOST
ZUUL_HOST=${ZUUL_HOST:-"review.opendev.org"}
echo ""
fi
ZUUL_HOST=${ZUUL_HOST:-"review.opendev.org"}
if [[ -z "$ZUUL_CHANGES" ]]; then
interactive=1
echo "Specify ZUUL_CHANGES variable from logs/reproduce.sh"
read -p "ZUUL_CHANGES=" ZUUL_CHANGES
echo ""
fi
export ZUUL_{HOST,CHANGES}
}
gerrit-gate () {
if [[ -z "$GERRIT_HOST" ]]; then
interactive=1
echo "Which Gerrit host to use? (default=review.opendev.org)"
read -p "GERRIT_HOST=" GERRIT_HOST
GERRIT_HOST=${GERRIT_HOST:-"review.opendev.org"}
echo ""
fi
if [[ -z "$GERRIT_BRANCH" ]]; then
interactive=1
echo "Which branch is the patch on? (default=master)"
read -p "GERRIT_BRANCH=" GERRIT_BRANCH
GERRIT_BRANCH=${GERRIT_BRANCH:-master}
echo ""
fi
if [[ -z "$GERRIT_CHANGE_ID" ]]; then
interactive=1
echo "What is the Change-Id? Can be found in the commit message."
echo "Note: all \"Depends-On:\" changes are going to be built as well."
read -p "GERRIT_CHANGE_ID=" GERRIT_CHANGE_ID
echo ""
fi
if [[ -z "$GERRIT_PATCHSET_REVISION" ]]; then
interactive=1
echo "What is the git commit hash of the patchset?"
echo "It can be found in the Commit field on Gerrit"
read -p "GERRIT_PATCHSET_REVISION=" GERRIT_PATCHSET_REVISION
echo ""
fi
export GERRIT_{HOST,BRANCH,CHANGE_ID,PATCHSET_REVISION}
}
interactive-gate () {
if [[ -n "$ZUUL_HOST" ]]; then
reproducer_type=zuul
fi
if [[ -z "$ZUUL_HOST" && -z "$GERRIT_HOST" ]]; then
interactive=1
echo "Do you want to reproduce an environment from an upstream CI Zuul job"
echo "or use a Gerrit change? (default=gerrit)"
read -p "[zuul/GERRIT] " reproducer_type
echo ""
fi
if [[ $reproducer_type = 'zuul' ]]; then
zuul-gate
else
gerrit-gate
fi
if [[ "$interactive" = "1" ]]; then
echo "Check if these values are correct:"
else
echo "Running with the following variables:"
fi
echo ""
if [[ $reproducer_type = 'zuul' ]]; then
echo "ZUUL_HOST=$ZUUL_HOST"
echo "ZUUL_CHANGES=$ZUUL_CHANGES"
echo "export ZUUL_{HOST,CHANGES}"
else
echo "GERRIT_HOST=$GERRIT_HOST"
echo "GERRIT_BRANCH=$GERRIT_BRANCH"
echo "GERRIT_CHANGE_ID=$GERRIT_CHANGE_ID"
echo "GERRIT_PATCHSET_REVISION=$GERRIT_PATCHSET_REVISION"
echo "export GERRIT_{HOST,BRANCH,CHANGE_ID,PATCHSET_REVISION}"
fi
echo ""
if [[ "$interactive" = "1" ]]; then
echo "Note: You can re-run this script non-interactively by pasting"
echo "the lines above to the console before rerunning the script."
echo "Hit ENTER to continue, or CTRL-C to exit"
read
fi
}
while [ "x$1" != "x" ]; do
case "$1" in
--working-dir|-w)
WORKSPACE=$(realpath $2)
shift
;;
--config|-c)
CONFIG=$2
shift
;;
--delete-all-stacks|-d)
DELETE_ALL_STACKS=true
;;
--no-gate|-n)
GATE=0
;;
--release|-r)
RELEASE=$2
shift
;;
--help|-h)
usage
exit
;;
--) shift
break
;;
-*) echo "ERROR: unknown option: $1" >&2
usage >&2
exit 2
;;
*) break
;;
esac
shift
done
pushd $(dirname ${BASH_SOURCE[0]:-$0})
# variables needed for the CI script
export VIRTHOST=$1
export WORKSPACE
if [[ -z $VIRTHOST ]]; then
usage
echo ""
echo "Specify the virthost to use. You need to be able to ssh as root without"
echo "password with your current user (i.e. ssh root@\$VIRTHOST must succeed)"
exit 1
fi
if [ "$GATE" = "1" ]; then
interactive-gate
JOB_TYPE=dlrn-gate
else
JOB_TYPE=periodic
fi
BASE_QUICKSTART_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bash $BASE_QUICKSTART_DIR/ci-scripts/full-deploy.sh $RELEASE $BUILD_SYS $CONFIG $JOB_TYPE
popd