Skip to content
Snippets Groups Projects

ci: enable LAVA boot and smoke tests on qemu devices for new MRs

Merged Chase Qi requested to merge (removed):pre-merge-test into kirkstone
1 file
+ 20
5
Compare changes
  • Side-by-side
  • Inline
@@ -9,7+9,7 @@
image:
name: registry.ostc-eu.org/ostc/oniro/bitbake-builder:latest
variables:
GIT_STRATEGY: none
CI_LAVA_INSTANCE: "https://lava.ostc-eu.org/"
CI_SQUAD_INSTANCE: "https://squadp.svc.ostc-eu.dev"
CI_SQUAD_PROJECT_NAME: "oniro-test-mr"
@@ -108,7+108,7 @@
variables:
GIT_STRATEGY: none
CI_LAVA_INSTANCE: "https://lava.ostc-eu.org/"
CI_SQUAD_INSTANCE: "https://squadp.svc.ostc-eu.dev"
script:
- |
# 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
# report job is successful or not.
incomplete="$(curl --silent $CI_SQUAD_INSTANCE/api/builds/$CI_PIPELINE_ID/status/ | jq -r '.test_runs_incomplete')"
if [ "$incomplete" != "0" ]; then
squad_build_id="$(curl --silent "$CI_SQUAD_INSTANCE/api/builds/?version=$CI_PIPELINE_ID" | jq -r '.results[0].id')"
curl --silent "$CI_SQUAD_INSTANCE/api/builds/$squad_build_id/testjobs/" > test_jobs.json
# Generate test reports in junit format.
jq -r '.results | .[] | .job_id' test_jobs.json | grep -v '[^0-9]' > job_ids.txt
echo "Pulling results back from LAVA ..."
while read -r id; do
curl --silent -o job_$id.xml "https://lava.ostc-eu.org//api/v0.2/jobs/$id/junit/?classname_prefix=$id"
done < job_ids.txt
# Print LAVA job url and job status.
jq -r '.results | .[] | .external_url, .job_status' test_jobs.json | tee job_status.txt
# Fail the GitLab CI job if any of the LAVA jobs failed.
if grep -qi "incomplete" job_status.txt; then
echo "ERROR: Incomplete test job reported: exit code 1"
exit 1
fi
artifacts:
when: always
paths:
- job_*.xml
reports:
junit:
- job_*.xml
rules:
- if: '$CI_SQUAD_TOKEN == null'
Loading