Skip to content
Snippets Groups Projects
Commit 86297cb2 authored by Stevan Radaković's avatar Stevan Radaković
Browse files

Submit jobs to squad instead of to LAVA directly


This is a first patch to introduce squad as a middleman in handling
LAVA job.

Signed-off-by: default avatarStevan Radaković <stevan.radakovic@linaro.org>
parent ee052538
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !107. Comments created here will be created in the context of that merge request.
...@@ -53,8 +53,8 @@ ...@@ -53,8 +53,8 @@
&& git remote add incoming-merged "$CI_MERGE_REQUEST_SOURCE_PROJECT_URL" \ && git remote add incoming-merged "$CI_MERGE_REQUEST_SOURCE_PROJECT_URL" \
&& git fetch incoming-merged ); && git fetch incoming-merged );
fi; fi;
echo "CI: Switching $CI_ONIRO_GIT_REPO_PATH to $CI_COMMIT_SHA"; #echo "CI: Switching $CI_ONIRO_GIT_REPO_PATH to $CI_COMMIT_SHA";
( cd "$CI_ONIRO_GIT_REPO_PATH" && git checkout "$CI_COMMIT_SHA" ); #( cd "$CI_ONIRO_GIT_REPO_PATH" && git checkout "$CI_COMMIT_SHA" );
fi fi
set +x set +x
......
...@@ -68,17 +68,21 @@ ...@@ -68,17 +68,21 @@
mv job_def.yaml lava_jobs/ mv job_def.yaml lava_jobs/
fi fi
set +x set +x
# Submit the job to LAVA. # 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
lava_job_id=$(curl -X POST -H "Authorization: Token $CI_LAVA_TOKEN" -F "definition=$(<${job_def})" "$CI_LAVA_INSTANCE/api/v0.2/jobs/" | jq ".job_ids" | tr -d "[\n ]") # TODO: do we need build_id from squad?
if [ "${lava_job_id}" != "null" ]; then #build_id=$(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}")
echo "$CI_LAVA_INSTANCE/scheduler/job/$lava_job_id" 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}"
echo "$lava_job_id" >> job_ids_"${CI_JOB_NAME}_${lava_job_id}".txt
else #lava_job_id=$(curl -X POST -H "Authorization: Token $CI_LAVA_TOKEN" -F "definition=$(<${job_def})" "$CI_LAVA_INSTANCE/api/v0.2/jobs/" | jq ".job_ids" | tr -d "[\n ]")
echo "Failed to submit ${job_def}" #if [ "${lava_job_id}" != "null" ]; then
exit 1 # echo "$CI_LAVA_INSTANCE/scheduler/job/$lava_job_id"
fi # echo "$lava_job_id" >> job_ids_"${CI_JOB_NAME}_${lava_job_id}".txt
#else
# echo "Failed to submit ${job_def}"
# exit 1
#fi
done done
artifacts: artifacts:
paths: paths:
...@@ -88,12 +92,12 @@ ...@@ -88,12 +92,12 @@
# Run the build when it is scheduled. # Run the build when it is scheduled.
- if: $CI_PIPELINE_SOURCE == "schedule" - if: $CI_PIPELINE_SOURCE == "schedule"
# Do not run pipelines for draft merge requests unless manually triggered. # Do not run pipelines for draft merge requests unless manually triggered.
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TITLE =~ /^(wip|draft):.*/i' # - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TITLE =~ /^(wip|draft):.*/i'
when: manual # when: manual
# Run the build when a merge request is created. # Run the build when a merge request is created.
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' # - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# Run the build when a tag is placed. # Run the build when a tag is placed.
- if: '$CI_COMMIT_TAG' # - if: '$CI_COMMIT_TAG'
.lava-report: .lava-report:
interruptible: true interruptible: true
...@@ -108,6 +112,8 @@ ...@@ -108,6 +112,8 @@
script: script:
- | - |
incomplete=false incomplete=false
# TODO: here get all jobs from squad and check status, or just check some squad field
# TODO: https://qa-reports.linaro.org/api/builds/106391/status/ (test_runs_incomplete)
for file in $(find ./ -name "job_ids_*.txt"); do for file in $(find ./ -name "job_ids_*.txt"); do
echo "Job file: $file" echo "Job file: $file"
while read -r p; do while read -r p; do
......
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