Skip to content

Commit 06eaf80

Browse files
committed
fix
1 parent 5656dc4 commit 06eaf80

File tree

1 file changed

+78
-34
lines changed

1 file changed

+78
-34
lines changed

.github/workflows/ci.yml

Lines changed: 78 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ permissions:
2828
contents: read
2929

3030
jobs:
31-
sim:
31+
simulator-ci:
3232
runs-on: ubuntu-24.04
3333
timeout-minutes: 60
3434

@@ -100,7 +100,7 @@ jobs:
100100
- name: Build CloudStack (simulator)
101101
working-directory: cloudstack
102102
run: |
103-
mvn -B -P developer,systemvm -Dsimulator -DskipTests -T"$(nproc)" clean install
103+
mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc)
104104
105105
- name: Deploy simulator DB + marvin
106106
working-directory: cloudstack
@@ -110,6 +110,7 @@ jobs:
110110
python3 -m pip install --user --upgrade tools/marvin/dist/Marvin-*.tar.gz
111111
112112
- name: Start CloudStack mgmt (Jetty) in background
113+
id: start_ms
113114
working-directory: cloudstack
114115
run: |
115116
set -euo pipefail
@@ -153,16 +154,27 @@ jobs:
153154
test -n "$CURL_COUNT" -a -n "$CMK_COUNT"
154155
[ "$CMK_COUNT" -ge 1 ]
155156
156-
- name: List zones (table) + export first id
157+
- name: List API
157158
run: |
158159
"${CMK_BIN}" set output table
159-
"${CMK_BIN}" listZones || true
160+
OUT=$("${CMK_BIN}" listZones)
161+
echo "$OUT"
162+
if [ -z "$OUT" ]; then
163+
echo "No output from listZones. Failing."
164+
exit 1
165+
fi
160166
"${CMK_BIN}" set output json
161-
ZONE_ID=$("${CMK_BIN}" listZones | jq -r '.zone[0].id')
167+
OUT=$("${CMK_BIN}" listZones)
168+
echo "$OUT"
169+
if [ -z "$OUT" ]; then
170+
echo "No output from listZones. Failing."
171+
exit 1
172+
fi
173+
ZONE_ID=$(echo "$OUT" | jq -r '.zone[0].id')
162174
echo "ZONE_ID=$ZONE_ID" >> $GITHUB_ENV
163175
test -n "$ZONE_ID"
164176
165-
- name: listZones with filter (only id,name)
177+
- name: List API with filter
166178
run: |
167179
"${CMK_BIN}" set output json
168180
OUT=$("${CMK_BIN}" listZones filter=id,name)
@@ -171,7 +183,7 @@ jobs:
171183
and (all(.zone[]; has("id") and has("name") and ((. | keys - ["id","name"])|length==0)))
172184
'
173185
174-
- name: listZones with exclude (no id,name)
186+
- name: List API with exclude
175187
run: |
176188
"${CMK_BIN}" set output json
177189
OUT=$("${CMK_BIN}" listZones exclude=id,name)
@@ -180,79 +192,110 @@ jobs:
180192
and (all(.zone[]; (has("id") or has("name"))|not))
181193
'
182194
183-
- name: createProject (base)
195+
- name: "Create API"
184196
run: |
185197
"${CMK_BIN}" set output json
186-
"${CMK_BIN}" createProject name=test || true
198+
OUT=$("${CMK_BIN}" createUser account=admin [email protected] firstname=Test lastname=User password=password username=test || true)
199+
echo "$OUT"
200+
if [ -n "$OUT" ]; then
201+
echo "$OUT" | jq -e '
202+
(.user // {}) as $p
203+
| ($p|type=="object")
204+
and ($p|has("id") and has("email"))
205+
and ((($p|keys) - ["id","email"])|length>0)
206+
'
207+
else
208+
echo "No output. Failing strict check."
209+
exit 1
210+
fi
187211
188-
- name: createProject with filter (only id,name)
212+
- name: Create API with filter
189213
run: |
190214
"${CMK_BIN}" set output json
191-
OUT=$("${CMK_BIN}" createProject name=test-filter filter=id,name || true)
215+
OUT=$("${CMK_BIN}" createUser account=admin [email protected] firstname=Test lastname=User password=password username=test-filter filter=id,email || true)
192216
echo "$OUT"
193217
if [ -n "$OUT" ]; then
194218
echo "$OUT" | jq -e '
195-
(.project // {}) as $p
219+
(.user // {}) as $p
196220
| ($p|type=="object")
197-
and ($p|has("id") and has("name"))
198-
and ((($p|keys) - ["id","name"])|length==0)
221+
and ($p|has("id") and has("email"))
222+
and ((($p|keys) - ["id","email"])|length==0)
199223
'
200224
else
201-
echo "No output. Skipping strict check."
225+
echo "No output. Failing strict check."
226+
exit 1
202227
fi
203228
204-
- name: createProject with exclude (no id,name)
229+
- name: Create API with exclude
205230
run: |
206231
"${CMK_BIN}" set output json
207-
OUT=$("${CMK_BIN}" createProject name=test-exclude exclude=id,name || true)
232+
OUT=$("${CMK_BIN}" createUser account=admin [email protected] firstname=Test lastname=User password=password username=test-exclude exclude=id,email || true)
208233
echo "$OUT"
209234
if [ -n "$OUT" ]; then
210235
echo "$OUT" | jq -e '
211-
(.project // {}) as $p
236+
(.user // {}) as $p
212237
| ($p|type=="object")
213-
and ((($p|has("id")) or ($p|has("name")))|not)
238+
and ((($p|has("id")) or ($p|has("email")))|not)
214239
'
215240
else
216-
echo "No output. Skipping strict check."
241+
echo "No output. Failing strict check."
242+
exit 1
217243
fi
218244
219-
- name: Get template and service offering IDs
245+
- name: Get template and service offering IDs for Async API test
220246
run: |
221247
TID=$("${CMK_BIN}" listTemplates listall=true templatefilter=executable | jq -r '.template[0].id')
222248
SOID=$("${CMK_BIN}" listServiceOfferings | jq -r '.serviceoffering[0].id')
223249
echo "TEMPLATE_ID=$TID" >> $GITHUB_ENV
224250
echo "SERVICE_OFFERING_ID=$SOID" >> $GITHUB_ENV
225251
test -n "$TID" -a -n "$SOID"
226252
227-
- name: deployVirtualMachine (base)
253+
- name: Async API
228254
run: |
229255
"${CMK_BIN}" set output json
230-
"${CMK_BIN}" deployVirtualMachine zoneid=${ZONE_ID} templateid=${TEMPLATE_ID} serviceofferingid=${SERVICE_OFFERING_ID} || true
256+
OUT=$("${CMK_BIN}" deployVirtualMachine zoneid=${ZONE_ID} templateid=${TEMPLATE_ID} serviceofferingid=${SERVICE_OFFERING_ID} || true)
257+
if [ -n "$OUT" ]; then
258+
echo "$OUT" | jq -e '
259+
(.virtualmachine // {}) as $p
260+
| ($p|type=="object")
261+
and ($p|has("id") and has("name"))
262+
and ((($p|keys) - ["id","name"])|length>0)
263+
'
264+
else
265+
echo "No output. Failing strict check."
266+
exit 1
267+
fi
231268
232-
- name: deployVirtualMachine with filter (only id)
269+
- name: Async API with filter
233270
run: |
234271
"${CMK_BIN}" set output json
235-
OUT=$("${CMK_BIN}" deployVirtualMachine zoneid=${ZONE_ID} templateid=${TEMPLATE_ID} serviceofferingid=${SERVICE_OFFERING_ID} filter=id || true)
236-
echo "$OUT"
272+
OUT=$("${CMK_BIN}" deployVirtualMachine zoneid=${ZONE_ID} templateid=${TEMPLATE_ID} serviceofferingid=${SERVICE_OFFERING_ID} filter=id,name || true)
237273
if [ -n "$OUT" ]; then
238274
echo "$OUT" | jq -e '
239-
((.virtualmachine?.id? // empty) | tostring | length) > 0
275+
(.virtualmachine // {}) as $p
276+
| ($p|type=="object")
277+
and ($p|has("id") and has("name"))
278+
and ((($p|keys) - ["id","name"])|length==0)
240279
'
241280
else
242-
echo "No output. Skipping strict check."
281+
echo "No output. Failing strict check."
282+
exit 1
243283
fi
244284
245-
- name: deployVirtualMachine with exclude (no id)
285+
- name: Async API with exclude
246286
run: |
247287
"${CMK_BIN}" set output json
248-
OUT=$("${CMK_BIN}" deployVirtualMachine zoneid=${ZONE_ID} templateid=${TEMPLATE_ID} serviceofferingid=${SERVICE_OFFERING_ID} exclude=id || true)
288+
OUT=$("${CMK_BIN}" deployVirtualMachine zoneid=${ZONE_ID} templateid=${TEMPLATE_ID} serviceofferingid=${SERVICE_OFFERING_ID} exclude=id,name || true)
249289
echo "$OUT"
250290
if [ -n "$OUT" ]; then
251291
echo "$OUT" | jq -e '
252-
(.virtualmachine? | has("id") | not)
292+
(.virtualmachine // {}) as $p
293+
| ($p|type=="object")
294+
and ((($p|has("id")) or ($p|has("name")))|not)
253295
'
254296
else
255-
echo "No output. Skipping strict check."
297+
echo "No output. Failing strict check."
298+
exit 1
256299
fi
257300
258301
- name: Change profile (user) and compare API surface
@@ -268,8 +311,9 @@ jobs:
268311
test $USER_COUNT -le $ADMIN_COUNT
269312
270313
- name: Stop simulator MS
314+
if: ${{ always() && steps.start_ms.outcome == 'success' }}
271315
working-directory: cloudstack
272316
run: |
273-
echo -e "Stopping Simulator, integration tests run completed\n"
274-
mvn -Dsimulator -pl client jetty:stop 2>&1
317+
echo -e "Stopping Simulator, integration tests run completed\n"
318+
mvn -Dsimulator -pl client jetty:stop 2>&1
275319

0 commit comments

Comments
 (0)