From 4aa451241f39cf2d911640f08130a79df46d4655 Mon Sep 17 00:00:00 2001 From: Lorenzo Pagliai <lorenzo.pagliai@seco.com> Date: Fri, 21 Apr 2023 10:00:50 +0200 Subject: [PATCH] [TESTING] Add test-probe stage * First implementation of LAVA testing of Edgehog Embedded Full Image * First support for A62, C20, C26, C43, C12 * The test is executed every time a new build is executed by triggering it manually or on schedule (allow to fail rule) * Change rule for deploy, changelog to manually run on MR --- boards/.a62.yml | 8 ++++ boards/.c12.yml | 8 ++++ boards/.c20.yml | 10 ++++- boards/.c26.yml | 8 ++++ boards/.c43.yml | 8 ++++ manifest-pipeline-yocto.yml | 84 +++++++++++++++++++++++++++++++------ 6 files changed, 113 insertions(+), 13 deletions(-) diff --git a/boards/.a62.yml b/boards/.a62.yml index 89cb69e..b19d807 100644 --- a/boards/.a62.yml +++ b/boards/.a62.yml @@ -64,4 +64,12 @@ deploy-edgehog-embedded-full-a62: artifacts: true variables: <<: *deploy-edgehog-a62 + <<: *build-edgehog-embedded-a62-full + +test-edgehog-embedded-full-a62: + extends: .test + needs: + - job: deploy-edgehog-embedded-full-a62 + artifacts: true + variables: <<: *build-edgehog-embedded-a62-full \ No newline at end of file diff --git a/boards/.c12.yml b/boards/.c12.yml index 2107712..d486be2 100644 --- a/boards/.c12.yml +++ b/boards/.c12.yml @@ -64,4 +64,12 @@ deploy-edgehog-embedded-full-c12: artifacts: true variables: <<: *deploy-edgehog-c12 + <<: *build-edgehog-embedded-c12-full + +test-edgehog-embedded-full-c12: + extends: .test + needs: + - job: deploy-edgehog-embedded-full-c12 + artifacts: true + variables: <<: *build-edgehog-embedded-c12-full \ No newline at end of file diff --git a/boards/.c20.yml b/boards/.c20.yml index abe85d6..57dcdfc 100644 --- a/boards/.c20.yml +++ b/boards/.c20.yml @@ -64,4 +64,12 @@ deploy-edgehog-embedded-full-c20: artifacts: true variables: <<: *deploy-edgehog-c20 - <<: *build-edgehog-embedded-c20-full \ No newline at end of file + <<: *build-edgehog-embedded-c20-full + +test-edgehog-embedded-full-c20: + extends: .test + needs: + - job: deploy-edgehog-embedded-full-c20 + artifacts: true + variables: + <<: *build-edgehog-embedded-c20-full \ No newline at end of file diff --git a/boards/.c26.yml b/boards/.c26.yml index f7e3771..b2154a8 100644 --- a/boards/.c26.yml +++ b/boards/.c26.yml @@ -64,4 +64,12 @@ deploy-edgehog-embedded-full-c26: artifacts: true variables: <<: *deploy-edgehog-c26 + <<: *build-edgehog-embedded-c26-full + +test-edgehog-embedded-full-c26: + extends: .test + needs: + - job: deploy-edgehog-embedded-full-c26 + artifacts: true + variables: <<: *build-edgehog-embedded-c26-full \ No newline at end of file diff --git a/boards/.c43.yml b/boards/.c43.yml index 515b65f..7c1c84d 100644 --- a/boards/.c43.yml +++ b/boards/.c43.yml @@ -64,4 +64,12 @@ deploy-edgehog-embedded-full-c43: artifacts: true variables: <<: *deploy-edgehog-c43 + <<: *build-edgehog-embedded-c43-full + +test-edgehog-embedded-full-c43: + extends: .test + needs: + - job: deploy-edgehog-embedded-full-c43 + artifacts: true + variables: <<: *build-edgehog-embedded-c43-full \ No newline at end of file diff --git a/manifest-pipeline-yocto.yml b/manifest-pipeline-yocto.yml index e622bbe..bba4070 100644 --- a/manifest-pipeline-yocto.yml +++ b/manifest-pipeline-yocto.yml @@ -37,10 +37,9 @@ variables: edgehog/layers/seco/meta-seco-edgehog-embedded edgehog/layers/external/poky edgehog/layers/external/linux-imx - - - # This is the jinja2 template file used to generate the build jobs - #BUILD_JOBS_TEMPLATE: build-jobs-yocto.yml.jinja2 + #GitLab group containing LAVA tests + TEST_REPO_URL: "https://gitlab-ci-token:${GITBOT_TOKEN}@git.seco.com/devops/lava-test-suite/lava-test.git" + TEST_BRANCH: main stages: # - manifest-pipeline @@ -50,6 +49,7 @@ stages: - changelog - notify - release + - test-probe workflow: rules: @@ -256,10 +256,8 @@ retrigger: timeout: 1h tags: - azure_deploy - rules: &schedule_tag_rule - # Trigger deploy jobs only on a schedule basis (for weekly release) or on tag - - if: $CI_PIPELINE_SOURCE == "schedule" - - if: $CI_COMMIT_TAG + rules: + - *build_rule script: - echo "Deploying packages..." - echo "This is the board for which the build has been performed... ${BOARD}" @@ -352,7 +350,7 @@ changelog: - send_notify allow_failure: true rules: - - *schedule_tag_rule + - *build_rule script: - PROJECT_ARGS="" - for project in ${CHANGELOG_PROJECTS}; do @@ -382,8 +380,10 @@ notify: tags: - send_notify allow_failure: true - rules: - - *schedule_tag_rule + rules: &schedule_tag_rule + # Trigger deploy jobs only on a schedule basis (for weekly release) or on tag + - if: $CI_PIPELINE_SOURCE == "schedule" + - if: $CI_COMMIT_TAG script: - | echo -e "The job results for all boards are listed below (also available by clicking on the **Job Report** button)." >> Job_message.txt @@ -448,4 +448,64 @@ release: echo $command >> release.sh cat release.sh chmod +x release.sh - sh release.sh \ No newline at end of file + sh release.sh + +########################## +######### TEST ########### +########################## + +.initSSH: &initSSH + - mkdir -p ~/.ssh + - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts + - echo ~/.ssh/known_hosts + - echo "$SSH_CONFIG_FILE" > ~/.ssh/config + - echo ~/.ssh/config + - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + +.test: + image: lava-submitter:v0.1 + tags: + - lava-server + stage: test-probe + timeout: 4h + cache: {} + rules: + - *build_rule + artifacts: + when: always + paths: + - "results/**" + reports: + junit: results/results-*.xml + allow_failure: true + variables: + GIT_STRATEGY: none + before_script: + - *initSSH + - git clone git@git.seco.com:devops/lava-test-suite/lava-test.git + script: + - ls -la + - link_report=$(find . -iname link*report*"${BOARD}"*.txt) + - echo ${link_report} + - sed -i 's/\"//g' ${link_report} + - cat ${link_report} + - image_url=$(cat ${link_report} | grep 'seco.*'"${BOARD}"'.*image.*.wic.bz2'| grep -v latest) + - echo ${image_url} + - | + if [ -n "$CUSTOM" ]; then + image_url="${image_url}?${AZURE_STORAGE_PUBLIC_SAS_TOKEN}" + fi + - | + echo "Submitting LAVA job .." + python3 lava-test/scripts/submit_test.py \ + --image-update True \ + --image ${image_url} \ + --lavaserver-ip 10.197.197.10 \ + --webserver-ip lavalab.seco.com \ + --jobname ${CI_JOB_NAME}_${CI_PIPELINE_ID} \ + "Gitlab build test ${CI_PIPELINE_ID}" \ + --results-path "results" \ + --test-repo ${TEST_REPO_URL} \ + --test-repo-branch ${TEST_BRANCH} \ + --test-plan ${CI_PARAM_TEST_SUITE} \ No newline at end of file -- GitLab