Skip to content
Snippets Groups Projects
Commit 074402b7 authored by Chase Qi's avatar Chase Qi
Browse files

.oniro-ci: use testjobs api to check job status


Signed-off-by: default avatarChase Qi <chase.qi@linaro.org>
parent 4ebca79f
No related branches found
No related tags found
No related merge requests found
...@@ -108,17 +108,19 @@ ...@@ -108,17 +108,19 @@
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
CI_LAVA_INSTANCE: "https://lava.ostc-eu.org/" CI_LAVA_INSTANCE: "https://lava.ostc-eu.org/"
CI_SQUAD_INSTANCE: "https://squadp.svc.ostc-eu.dev"
script: script:
- | - |
# Get the test_runs_incomplete value from build status. That will tell # Get the test_runs_incomplete value from build status. That will tell
# us if any of the LAVA jobs failed and we can determine whether the # us if any of the LAVA jobs failed and we can determine whether the
# report job is successful or not. # report job is successful or not.
incomplete="$(curl --silent $CI_SQUAD_INSTANCE/api/builds/$CI_PIPELINE_ID/status/ | jq -r '.test_runs_incomplete')" squad_build_id="$(curl --silent "$CI_SQUAD_INSTANCE/api/builds/?version=$CI_PIPELINE_ID" | jq -r '.results[0].id')"
if [ "$incomplete" != "0" ]; then curl --silent "$CI_SQUAD_INSTANCE/api/builds/$squad_build_id/testjobs/" > test_jobs.json
jq -r '.results | .[] | .external_url, .job_status' test_jobs.json | tee job_status.txt
if grep -qi "incomplete" job_status.txt; then
echo "ERROR: Incomplete test job reported: exit code 1" echo "ERROR: Incomplete test job reported: exit code 1"
exit 1 exit 1
fi fi
rules: rules:
- if: '$CI_SQUAD_TOKEN == null' - if: '$CI_SQUAD_TOKEN == null'
when: never when: never
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment