Skip to content
Snippets Groups Projects

WIP: lava ACTS integration

Open Luca Favaretto requested to merge lucafavaretto/meta-openharmony:ACTS-lava into kirkstone
1 file
+ 125
0
Compare changes
  • Side-by-side
  • Inline
+ 125
0
@@ -368,6 +368,108 @@ build:
@@ -368,6 +368,108 @@ build:
- build/tmp-*/buildstats*
- build/tmp-*/buildstats*
expire_in: 1 month
expire_in: 1 month
 
 
##
 
## Submits a job to LAVA with CI variables
 
##
 
.lava-test:
 
interruptible: true
 
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_GROUP_NAME: ""
 
CI_SQUAD_PROJECT_NAME: ""
 
CI_LAVA_JOB_PRIORITY: "medium"
 
before_script:
 
- test -n "$CI_LAVA_TOKEN" || (
 
echo "precondition failed - please disable the child job if CI_LAVA_TOKEN not set in gitlab CI/CD variables"
 
&& exit 1 )
 
# Check if the job is configured properly.
 
- test -n "$MACHINE" || (
 
echo "precondition failed - set MACHINE to the name of the target device for which the image is built"
 
&& exit 1 )
 
- test -n "$CI_BUILD_JOB_NAME" || (
 
echo "precondition failed - set CI_BUILD_JOB_NAME to the appropriate job name from which LAVA will pick up build artifact"
 
&& exit 1 )
 
- test -n "$CI_LAVA_JOB_DEFINITION" || (
 
echo "precondition failed - set CI_LAVA_JOB_DEFINITION to the URL of the LAVA test job definition"
 
&& exit 1 )
 
- test -n "$CI_REPORT_JOB_NAME" || (
 
echo "precondition failed - set CI_REPORT_JOB_NAME to the CI job name which will gather results back from Squad"
 
&& exit 1 )
 
- test -n "$CI_SQUAD_GROUP_NAME" || (
 
echo "precondition failed - set CI_SQUAD_GROUP_NAME to the squad group name."
 
&& exit 1 )
 
- test -n "$CI_SQUAD_PROJECT_NAME" || (
 
echo "precondition failed - set CI_SQUAD_PROJECT_NAME to the squad project name."
 
&& exit 1 )
 
script:
 
# Build callback URL for the "report" job
 
- |
 
curl --silent \
 
--header "PRIVATE-TOKEN: $GITLAB_API_TOKEN" \
 
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs?per_page=100" > jobs-manual.json
 
- job_id="$(jq -r ".[] | select(.name == \"$CI_REPORT_JOB_NAME\") | .id" jobs-manual.json)"
 
- build_job_id="$(jq -r ".[] | select(.name == \"$CI_BUILD_JOB_NAME\") | .id" jobs-manual.json)"
 
- update_job_id="$(jq -r ".[] | select(.name == \"$CI_UPDATE_JOB_NAME\") | .id" jobs-manual.json)"
 
- CALLBACK_URL="$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/${job_id}/play"
 
# Get the job definition from remote source.
 
- curl --silent "$CI_LAVA_JOB_DEFINITION" > job_def.yaml
 
# Update the job definition with CI data.
 
- sed -i -e 's/@ci_job_id@/'"$CI_JOB_ID"'/'
 
-e 's/@ci_project_id@/'"$CI_PROJECT_ID"'/'
 
-e 's/@ci_pipeline_id@/'"$CI_PIPELINE_ID"'/'
 
-e 's/@ci_lava_job_priority@/'"$CI_LAVA_JOB_PRIORITY"'/'
 
-e 's,@ci_pipeline_url@,'"$CI_PIPELINE_URL"','
 
-e 's,@update_job_id@,'"$update_job_id"','
 
-e 's/@build_job_id@/'"$build_job_id"'/' job_def.yaml
 
# Update the job with device configuration
 
- sed -i -e 's/@BOARD_RAM_SIZE@/'"$BOARD_RAM_SIZE"'/g' job_def.yaml
 
# Generate test jobs.
 
- |
 
set -x
 
rm -rf lava_jobs && mkdir lava_jobs
 
mv job_def.yaml lava_jobs/
 
set +x
 
# Submit the jobs to SQUAD.
 
- |
 
for job_def in $(find lava_jobs/ -name "*.yaml"); do
 
echo $CI_SQUAD_INSTANCE/api/submitjob/$CI_SQUAD_GROUP_NAME/$CI_SQUAD_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/$CI_SQUAD_GROUP_NAME/$CI_SQUAD_PROJECT_NAME/$CI_PIPELINE_ID/$MACHINE --header "Auth-Token: $CI_SQUAD_TOKEN" --form "backend=oniro_lava" --form "definition=@${job_def}"
 
done
 
# Attach a callback to this build to trigger the lava-report job
 
squad_build_id="$(curl --silent "$CI_SQUAD_INSTANCE/api/builds/?version=$CI_PIPELINE_ID" | jq -r '.results[0].id')"
 
curl --silent \
 
-X POST "$CI_SQUAD_INSTANCE/api/builds/$squad_build_id/callbacks/" \
 
-H "Authorization: Token $CI_SQUAD_TOKEN" \
 
-F "callback_url=$CALLBACK_URL" \
 
-F "callback_record_response=true"
 
artifacts:
 
paths:
 
- lava_jobs/*.yaml
 
rules:
 
- if: '$CI_SQUAD_TOKEN == null'
 
when: never
 
# Run the build when it is scheduled.
 
- if: $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULED_TYPE == "daily"
 
# 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'
 
when: manual
 
# Run the build when a merge request is created.
 
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
 
# Run the build when a tag is placed.
 
- if: '$CI_COMMIT_TAG'
 
 
.lava-test-mr:
 
extends: .lava-test
 
variables:
 
CI_LAVA_JOB_PRIORITY: "high"
 
CI_SQUAD_GROUP_NAME: "merge-request"
 
CI_SQUAD_PROJECT_NAME: "meta-oh"
 
# Build and execute OpenHarmony test image.
# Build and execute OpenHarmony test image.
#
#
# This will execute all included ptest test suites.
# This will execute all included ptest test suites.
@@ -435,6 +537,29 @@ acts:
@@ -435,6 +537,29 @@ acts:
reports:
reports:
junit: build/reports/latest/summary_report.xml
junit: build/reports/latest/summary_report.xml
 
#LAVA ACTS test
 
lava-raspberrypi4-64-acts:
 
needs: [build]
 
stage: test
 
extends: .lava-test-mr
 
variables:
 
MACHINE: raspberrypi4-64
 
CI_BUILD_JOB_NAME: oniro-openharmony-linux
 
# CI_LAVA_JOB_DEFINITION: "https://git.ostc-eu.org/OSTC/infrastructure/lava/lava-config/-/raw/master/lava.ostc-eu.org/job-definitions/ci/raspberrypi4-64-acts.yaml"
 
CI_LAVA_JOB_DEFINITION: "https://git.ostc-eu.org/OSTC/infrastructure/lava/lava-config/-/raw/master/lava.ostc-eu.org/job-definitions/ci/raspberrypi4-64-perf.yaml"
 
CI_REPORT_JOB_NAME: lava-report
 
 
lava-qemuarma7-acts:
 
needs: [build]
 
stage: test
 
extends: .lava-test-mr
 
variables:
 
MACHINE: qemuarma7
 
CI_BUILD_JOB_NAME: oniro-openharmony-linux
 
# CI_LAVA_JOB_DEFINITION: "https://git.ostc-eu.org/OSTC/infrastructure/lava/lava-config/-/raw/master/lava.ostc-eu.org/job-definitions/ci/qemuarma7-acts.yaml"
 
CI_LAVA_JOB_DEFINITION: "https://git.ostc-eu.org/OSTC/infrastructure/lava/lava-config/-/raw/master/lava.ostc-eu.org/job-definitions/ci/qemuarm-efi-perf.yaml"
 
CI_REPORT_JOB_NAME: lava-report
 
# Build OpenHarmony images using CI runner in China.
# Build OpenHarmony images using CI runner in China.
#
#
# Note, you might want to allow the mirror_ch job to complete before running
# Note, you might want to allow the mirror_ch job to complete before running
Loading