@@ -40,3 +40,240 @@ jobs:
40
40
shell : bash
41
41
run : |
42
42
cd tests && ./main.sh smoke
43
+
44
+ " upgrade-latest-stable " :
45
+ name : " Upgrade latest stable"
46
+ runs-on : ubuntu-latest
47
+ if : github.event.pull_request.draft == false
48
+ steps :
49
+
50
+ - name : Install Dependencies
51
+ shell : bash
52
+ run : |
53
+ set -euxo pipefail
54
+ sudo apt-get remove lxd lxd-client
55
+ sudo snap install snapcraft --classic
56
+ sudo snap install lxd
57
+ sudo lxd waitready
58
+ sudo lxd init --auto
59
+ sudo chmod a+wr /var/snap/lxd/common/lxd/unix.socket
60
+ echo "##[add-path]/snap/bin"
61
+
62
+ - name : Bootstrap Juju latest/stable
63
+ shell : bash
64
+ run : |
65
+ set -euxo pipefail
66
+ lxc network set lxdbr0 ipv6.address none
67
+ sudo snap install juju --classic
68
+ juju bootstrap localhost test
69
+ juju status
70
+ juju version
71
+
72
+ - name : Checkout
73
+ uses : actions/checkout@v2
74
+
75
+ - name : Build snap
76
+ shell : bash
77
+ run : |
78
+ set -euxo pipefail
79
+ snapcraft --use-lxd
80
+
81
+ - name : Install snap
82
+ shell : bash
83
+ run : |
84
+ set -euxo pipefail
85
+ sudo snap install *.snap --dangerous --classic
86
+
87
+ - name : Preflight
88
+ shell : bash
89
+ run : |
90
+ set -euxo pipefail
91
+ juju status
92
+ juju version
93
+
94
+ - name : Test upgrade controller
95
+ shell : bash
96
+ run : |
97
+ set -euxo pipefail
98
+ CURRENT=$(juju show-controller --format=json | jq -r '.test | .details | .["agent-version"]')
99
+
100
+ juju upgrade-controller --build-agent
101
+
102
+ attempt=0
103
+ while true; do
104
+ UPDATED=$(juju show-controller --format=json | jq -r '.test | .details | .["agent-version"]')
105
+ if [ "$CURRENT" != "$UPDATED" ]; then
106
+ break
107
+ fi
108
+ sleep 10
109
+ attempt=$((attempt+1))
110
+ if [ "$attempt" -eq 48 ]; then
111
+ echo "Upgrade controller timed out"
112
+ exit 1
113
+ fi
114
+ done
115
+
116
+ PANIC=$(juju debug-log --replay --no-tail -m controller | grep "panic" || true)
117
+ if [ "$PANIC" != "" ]; then
118
+ echo "Panic found:"
119
+ juju debug-log --replay --no-tail -m controller
120
+ exit 1
121
+ fi
122
+
123
+ - name : Test upgrade model
124
+ shell : bash
125
+ run : |
126
+ set -euxo pipefail
127
+ CURRENT=$(juju show-model default --format=json | jq -r '.default | .["agent-version"]')
128
+
129
+ VERSION=$(juju version | cut -d "-" -f 1,2 | xargs -I% echo "%.1")
130
+ juju upgrade-model --agent-version="$VERSION"
131
+
132
+ attempt=0
133
+ while true; do
134
+ UPDATED=$(juju show-model default --format=json | jq -r '.default | .["agent-version"]')
135
+ if [ "$CURRENT" != "$UPDATED" ]; then
136
+ break
137
+ fi
138
+ sleep 10
139
+ attempt=$((attempt+1))
140
+ if [ "$attempt" -eq 48 ]; then
141
+ echo "Upgrade model timed out"
142
+ exit 1
143
+ fi
144
+ done
145
+
146
+ PANIC=$(juju debug-log --replay --no-tail | grep "panic" || true)
147
+ if [ "$PANIC" != "" ]; then
148
+ echo "Panic found:"
149
+ juju debug-log --replay --no-tail
150
+ exit 1
151
+ fi
152
+
153
+ " upgrade-latest-beta " :
154
+ name : " Upgrade latest beta"
155
+ runs-on : ubuntu-latest
156
+ if : github.event.pull_request.draft == false
157
+ steps :
158
+
159
+ - name : Check
160
+ shell : bash
161
+ run : |
162
+ set -ux
163
+ set +e
164
+ snap info juju | grep -E "latest/beta:[[:space:]]+\^"
165
+ set -e
166
+ if [ $? -eq 1 ]; then
167
+ echo "::set-env name=RUN_TEST::RUN"
168
+ fi
169
+
170
+ - name : Install Dependencies
171
+ if : env.RUN_TEST == 'RUN'
172
+ shell : bash
173
+ run : |
174
+ set -euxo pipefail
175
+ sudo apt-get remove lxd lxd-client
176
+ sudo snap install snapcraft --classic
177
+ sudo snap install lxd
178
+ sudo lxd waitready
179
+ sudo lxd init --auto
180
+ sudo chmod a+wr /var/snap/lxd/common/lxd/unix.socket
181
+ echo "##[add-path]/snap/bin"
182
+
183
+ - name : Bootstrap Juju latest/beta
184
+ if : env.RUN_TEST == 'RUN'
185
+ shell : bash
186
+ run : |
187
+ set -euxo pipefail
188
+ lxc network set lxdbr0 ipv6.address none
189
+ sudo snap install juju --classic --channel="latest/beta"
190
+ juju bootstrap localhost test
191
+ juju status
192
+ juju version
193
+
194
+ - name : Checkout
195
+ if : env.RUN_TEST == 'RUN'
196
+ uses : actions/checkout@v2
197
+
198
+ - name : Build snap
199
+ if : env.RUN_TEST == 'RUN'
200
+ shell : bash
201
+ run : |
202
+ set -euxo pipefail
203
+ snapcraft --use-lxd
204
+
205
+ - name : Install snap
206
+ if : env.RUN_TEST == 'RUN'
207
+ shell : bash
208
+ run : |
209
+ set -euxo pipefail
210
+ sudo snap install *.snap --dangerous --classic
211
+
212
+ - name : Preflight
213
+ if : env.RUN_TEST == 'RUN'
214
+ shell : bash
215
+ run : |
216
+ set -euxo pipefail
217
+ juju status
218
+ juju version
219
+
220
+ - name : Test upgrade controller
221
+ if : env.RUN_TEST == 'RUN'
222
+ shell : bash
223
+ run : |
224
+ set -euxo pipefail
225
+ CURRENT=$(juju show-controller --format=json | jq -r '.test | .details | .["agent-version"]')
226
+
227
+ juju upgrade-controller --build-agent
228
+
229
+ attempt=0
230
+ while true; do
231
+ UPDATED=$(juju show-controller --format=json | jq -r '.test | .details | .["agent-version"]')
232
+ if [ "$CURRENT" != "$UPDATED" ]; then
233
+ break
234
+ fi
235
+ sleep 10
236
+ attempt=$((attempt+1))
237
+ if [ "$attempt" -eq 48 ]; then
238
+ echo "Upgrade controller timed out"
239
+ exit 1
240
+ fi
241
+ done
242
+
243
+ PANIC=$(juju debug-log --replay --no-tail -m controller | grep "panic" || true)
244
+ if [ "$PANIC" != "" ]; then
245
+ echo "Panic found:"
246
+ juju debug-log --replay --no-tail -m controller
247
+ exit 1
248
+ fi
249
+
250
+ - name : Test upgrade model
251
+ if : env.RUN_TEST == 'RUN'
252
+ shell : bash
253
+ run : |
254
+ set -euxo pipefail
255
+ CURRENT=$(juju show-model default --format=json | jq -r '.default | .["agent-version"]')
256
+
257
+ VERSION=$(juju version | cut -d "-" -f 1,2 | xargs -I% echo "%.1")
258
+ juju upgrade-model --agent-version="$VERSION"
259
+
260
+ attempt=0
261
+ while true; do
262
+ UPDATED=$(juju show-model default --format=json | jq -r '.default | .["agent-version"]')
263
+ if [ "$CURRENT" != "$UPDATED" ]; then
264
+ break
265
+ fi
266
+ sleep 10
267
+ attempt=$((attempt+1))
268
+ if [ "$attempt" -eq 48 ]; then
269
+ echo "Upgrade model timed out"
270
+ exit 1
271
+ fi
272
+ done
273
+
274
+ PANIC=$(juju debug-log --replay --no-tail | grep "panic" || true)
275
+ if [ "$PANIC" != "" ]; then
276
+ echo "Panic found:"
277
+ juju debug-log --replay --no-tail
278
+ exit 1
279
+ fi
0 commit comments