Skip to content
Snippets Groups Projects
Commit f79a7611 authored by Chase Qi's avatar Chase Qi
Browse files

ci: don't run lava test if required var CI_LAVA_TOKEN not set

CI_LAVA_TOKEN is required for submitting job to LAVA server. It should
be set in instance level gitlab CI/CD variables for testing forking dev
flow based MRs.

With `when: never` rule, test job will not be added to pipeline if the
above var not set. If the condition not set in test job that extends
`.lava-test`, `.lava-test` will ask user to do so and then exit with
unsuccessful job status. There is no easy way to exit early with
successful status yet. See
https://gitlab.com/gitlab-org/gitlab/-/issues/329217#note_572963049



Adding the above condition in `.lava-test` has no impact on test job
that extends the `.lava-test`.

Signed-off-by: default avatarChase Qi <chase.qi@linaro.org>
parent aa5892fd
No related branches found
No related tags found
No related merge requests found
...@@ -152,6 +152,9 @@ lava-zephyr-96b-nitrogen-tests: ...@@ -152,6 +152,9 @@ lava-zephyr-96b-nitrogen-tests:
CI_LAVA_JOB_DEFINITION: "https://git.ostc-eu.org/OSTC/infrastructure/lava/lava-config/-/raw/master/lava.ostc-eu.org/job-definitions/ci/nitrogen-test.yaml" CI_LAVA_JOB_DEFINITION: "https://git.ostc-eu.org/OSTC/infrastructure/lava/lava-config/-/raw/master/lava.ostc-eu.org/job-definitions/ci/nitrogen-test.yaml"
CI_BUILD_JOB_NAME: zephyr-96b-nitrogen-tests CI_BUILD_JOB_NAME: zephyr-96b-nitrogen-tests
CI_REPORT_JOB_NAME: lava-report CI_REPORT_JOB_NAME: lava-report
rules:
- if: '$CI_LAVA_TOKEN == ""'
when: never
lava-report: lava-report:
needs: [lava-linux-avenger96, lava-qemu-x86_64, lava-qemu-x86] needs: [lava-linux-avenger96, lava-qemu-x86_64, lava-qemu-x86]
......
...@@ -8,7 +8,12 @@ ...@@ -8,7 +8,12 @@
interruptible: true interruptible: true
image: image:
name: registry.ostc-eu.org/ostc/containers/ostc-builder:latest name: registry.ostc-eu.org/ostc/containers/ostc-builder:latest
variables:
CI_LAVA_INSTANCE: "https://lava.ostc-eu.org/"
before_script: 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. # Check if the job is configured properly.
- test -n "$CI_LAVA_JOB_DEFINITION" || ( - test -n "$CI_LAVA_JOB_DEFINITION" || (
echo "precondition failed - set CI_LAVA_JOB_DEFINITION to the URL of the LAVA test job definition" echo "precondition failed - set CI_LAVA_JOB_DEFINITION to the URL of the LAVA test job definition"
...@@ -77,6 +82,8 @@ ...@@ -77,6 +82,8 @@
image: image:
name: registry.ostc-eu.org/ostc/containers/ostc-builder:latest name: registry.ostc-eu.org/ostc/containers/ostc-builder:latest
stage: report stage: report
variables:
CI_LAVA_INSTANCE: "https://lava.ostc-eu.org/"
script: script:
- | - |
for file in $(find ./ -name "job_ids_*.txt"); do for file in $(find ./ -name "job_ids_*.txt"); 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