Skip to content
Snippets Groups Projects
Commit ee7aa66c authored by Stevan Radaković's avatar Stevan Radaković Committed by Zygmunt Krynicki
Browse files

test-generic.yaml: Utilize SQUAD API in CI jobs


Use SQUAD callback to trigger the lava-report pipeline job and
simplify lava-badge calculation by using SQUAD API.
SQUAD build ID is now implemented to be the same as pipeline ID.

Signed-off-by: default avatarStevan Radaković <stevan.radakovic@linaro.org>
parent aa5d3288
No related branches found
No related tags found
1 merge request!129test-generic.yaml: Utilize SQUAD API in CI jobs
...@@ -45,8 +45,7 @@ ...@@ -45,8 +45,7 @@
-e 's/@ci_project_id@/'"$CI_PROJECT_ID"'/' -e 's/@ci_project_id@/'"$CI_PROJECT_ID"'/'
-e 's/@ci_pipeline_id@/'"$CI_PIPELINE_ID"'/' -e 's/@ci_pipeline_id@/'"$CI_PIPELINE_ID"'/'
-e 's,@ci_pipeline_url@,'"$CI_PIPELINE_URL"',' -e 's,@ci_pipeline_url@,'"$CI_PIPELINE_URL"','
-e 's/@build_job_id@/'"$build_job_id"'/' -e 's/@build_job_id@/'"$build_job_id"'/' job_def.yaml
-e 's,@callback_url@,'"$CALLBACK_URL"',' job_def.yaml
# Generate test jobs. # Generate test jobs.
- | - |
set -x set -x
...@@ -72,8 +71,10 @@ ...@@ -72,8 +71,10 @@
# Submit the jobs to SQUAD. # Submit the jobs to SQUAD.
- | - |
for job_def in $(find lava_jobs/ -name "*.yaml"); do for job_def in $(find lava_jobs/ -name "*.yaml"); do
echo $CI_SQUAD_INSTANCE/api/submitjob/oniro-core/$CI_PROJECT_NAME/$CI_COMMIT_SHORT_SHA/$MACHINE --header "Auth-Token: $CI_SQUAD_TOKEN" --form "backend=oniro_lava" --form "definition=@${job_def}" echo $CI_SQUAD_INSTANCE/api/submitjob/oniro-core/$CI_PROJECT_NAME/$CI_PIPELINE_ID/$MACHINE --header "Auth-Token: $CI_SQUAD_TOKEN" --form "backend=oniro_lava" --form "definition=@${job_def}"
curl $CI_SQUAD_INSTANCE/api/submitjob/oniro-core/$CI_PROJECT_NAME/$CI_COMMIT_SHORT_SHA/$MACHINE --header "Auth-Token: $CI_SQUAD_TOKEN" --form "backend=oniro_lava" --form "definition=@${job_def}" curl $CI_SQUAD_INSTANCE/api/submitjob/oniro-core/$CI_PROJECT_NAME/$CI_PIPELINE_ID/$MACHINE --header "Auth-Token: $CI_SQUAD_TOKEN" --form "backend=oniro_lava" --form "definition=@${job_def}"
# Attach a callback to this build to trigger the lava-report job
curl -X POST /api/build/$CI_PIPELINE_ID/callbacks/ -F "callback_url=$CALLBACK_URL"
done done
artifacts: artifacts:
paths: paths:
...@@ -137,10 +138,8 @@ ...@@ -137,10 +138,8 @@
script: script:
- | - |
set -x set -x
curl --silent "$CI_API_V4_URL/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/test_report" > test-report.json pass_percentage="$(curl --silent https://squadp.svc.ostc-eu.dev/api/builds/$build_id/status/ | jq -r '.pass_percentage')"
total_count="$(jq '.total_count' test-report.json)" success_rate=`printf "%.2f" $pass_percentage`
success_count="$(jq '.success_count' test-report.json)"
success_rate=$(( 100 * success_count / total_count ))
anybadge --label=lava-test --value=${success_rate} --suffix='%' --file=lava-test.svg 50=red 60=orange 80=yellow 100=green anybadge --label=lava-test --value=${success_rate} --suffix='%' --file=lava-test.svg 50=red 60=orange 80=yellow 100=green
set +x set +x
artifacts: artifacts:
......
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