From 84ecb065feadd90b703a2b8c10f4be39bce093bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stevan=20Radakovi=C4=87?= <stevan.radakovic@linaro.org> Date: Fri, 5 Aug 2022 14:53:15 +0200 Subject: [PATCH] sysota: Use bundle job name in CI instead of build job name for rauc bundles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using build job name to download bundles doesn't work. We need to introduce new var and make it mandatory for lava jobs containing the `sysota` in job name. Signed-off-by: Stevan Radaković <stevan.radakovic@linaro.org> --- .gitlab-ci.yml | 2 ++ .oniro-ci/test-generic.yaml | 9 +++++++++ docs/ci/hidden-jobs/lava-test.rst | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 92e72eaf..f884183f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -477,6 +477,7 @@ lava-qemu-x86-sysota: CI_BUILD_JOB_NAME: linux-qemu-x86 CI_LAVA_JOB_DEFINITION: "https://git.ostc-eu.org/OSTC/infrastructure/lava/lava-config/-/raw/master/lava.ostc-eu.org/job-definitions/ci/qemu-x86-sysota.yaml" CI_REPORT_JOB_NAME: lava-report + CI_UPDATE_JOB_NAME: bundle-qemu-x86 lava-qemu-x86_64-sysota: needs: [bundle-qemu-x86_64] @@ -487,6 +488,7 @@ lava-qemu-x86_64-sysota: CI_BUILD_JOB_NAME: linux-qemu-x86_64 CI_LAVA_JOB_DEFINITION: "https://git.ostc-eu.org/OSTC/infrastructure/lava/lava-config/-/raw/master/lava.ostc-eu.org/job-definitions/ci/qemu-x86_64-sysota.yaml" CI_REPORT_JOB_NAME: lava-report + CI_UPDATE_JOB_NAME: bundle-qemu-x86_64 lava-report: extends: .lava-report diff --git a/.oniro-ci/test-generic.yaml b/.oniro-ci/test-generic.yaml index ab97b7d4..3f93cf65 100644 --- a/.oniro-ci/test-generic.yaml +++ b/.oniro-ci/test-generic.yaml @@ -33,11 +33,19 @@ - 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 LAVA" && exit 1 ) + # If the test job name contains 'sysota', usage of update job name is + # required. + - | + if [[ -z "$CI_UPDATE_JOB_NAME" ]] && [[ "$CI_JOB_NAME" == *"sysota"* ]]; then + echo "precondition failed - jobs with 'sysota' in their name must have CI_UPDATE_JOB_NAME variable with the name of the 'update' CI job that contains rauc bundles" + exit 1 + fi script: # Build callback URL for the "report" job - curl --silent "$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 @@ -46,6 +54,7 @@ -e 's/@ci_project_id@/'"$CI_PROJECT_ID"'/' -e 's/@ci_pipeline_id@/'"$CI_PIPELINE_ID"'/' -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 diff --git a/docs/ci/hidden-jobs/lava-test.rst b/docs/ci/hidden-jobs/lava-test.rst index 8c605bbb..681187de 100644 --- a/docs/ci/hidden-jobs/lava-test.rst +++ b/docs/ci/hidden-jobs/lava-test.rst @@ -45,6 +45,12 @@ The name of the ``report`` job which will be triggered manually when the LAVA job(s) are finished with executution. This job will collect the results from LAVA and import them to GitLab. +CI_UPDATE_JOB_NAME +------------------ + +The name of the ``update`` job which LAVA needs in order to download the +correct SySOTA bundle from the pipeline. + CI_LAVA_INSTANCE ---------------- -- GitLab