Tim Andersson has proposed merging qa-jenkins-jobs:hit-test-observer-integration into qa-jenkins-jobs:master.
Requested reviews: Canonical Platform QA Team (canonical-platform-qa) For more details, see: https://code.launchpad.net/~canonical-platform-qa/qa-jenkins-jobs/+git/qa-jenkins-jobs/+merge/481193 This MP integrates the test observer api calls into the jobs for the hardware testing. -- Your team Canonical Platform QA Team is requested to review the proposed merge of qa-jenkins-jobs:hit-test-observer-integration into qa-jenkins-jobs:master.
diff --git a/jobs/hardware-iso-testing/jobs.yaml b/jobs/hardware-iso-testing/jobs.yaml index f799418..dd58e81 100644 --- a/jobs/hardware-iso-testing/jobs.yaml +++ b/jobs/hardware-iso-testing/jobs.yaml @@ -35,15 +35,16 @@ test_case: - 'erase-and-reinstall' - 'entire-disk-with-zfs' - # - 'entire-disk-with-zfs-plus-encryption' # Match Text causing traceback + - 'entire-disk-with-zfs-plus-encryption' # Match Text causing traceback - 'entire-disk-with-installer-update' - # - 'entire-disk-with-lvm-and-encryption' # Match Text causing traceback + - 'entire-disk-with-lvm-and-encryption' # Match Text causing traceback - 'entire-disk-no-internet' - 'oem-install' - 'entire-disk-with-nvidia-drivers' jobs: - 'hit-{release}-test-case-dut-mapping' - 'hit-{release}-desktop-{test_case}' + - 'hit-{release}-test-observer-poller' # maybe the test observer url should be an env var? - job-template: name: 'hit-{release}-test-case-dut-mapping' @@ -74,39 +75,31 @@ - text: - '^{{release}}-.*.iso .+$' wrappers: + - workspace-cleanup - timestamps - timeout: timeout: 15 fail: true + - credentials-binding: + - text: + credential-id: GH_PAT + variable: GH_PAT builders: + - clear-artifacts - shell: | - #!/usr/bin/python3 - import os - import json - import random - import sys - duts = os.environ.get("DUT_IDS").split(" ") - test_cases = os.environ.get("TEST_CASES").split(" ") - if not duts or not test_cases: - sys.exit(1) - used_duts = [] - op_json = {{}} - while len(test_cases) > 0: - if len(duts) == 0: - duts = used_duts - used_duts = [] - random.shuffle(duts) - idx = random.randrange(len(duts)) - op_json[test_cases[0]] = duts[idx] - used_duts.append(duts[idx]) - del duts[idx] - del test_cases[0] - print(f"Assignments:\n{{json.dumps(op_json,indent=2)}}") - with open("{release}-test-case-dut-mapping.json", "w") as f: - json.dump(op_json, f) + #!/bin/bash + retry -t 3 -d 180 -- git clone -b $HIT_BRANCH https://oauth2:$gh_...@github.com/canonical/hardware-installer-testing.git + python3 -m venv env + . env/bin/activate + pip install -r hardware-installer-testing/requirements.txt + cd hardware-installer-testing/ + export RELEASE={release} + ./scripts/dispatcher.py --test-observer publishers: - archive: artifacts: '{release}-test-case-dut-mapping.json' + - archive: + artifacts: '{release}-dut-test-id-mapping.json' - job-template: name: 'hit-{release}-desktop-{test_case}' @@ -137,6 +130,10 @@ project: 'hit-{release}-test-case-dut-mapping' filter: '{release}-test-case-dut-mapping.json' which-build: last-successful + - copyartifact: + project: 'hit-{release}-test-case-dut-mapping' + filter: '{release}-dut-test-id-mapping.json' + which-build: last-successful - shell: command: | #!/bin/bash @@ -147,6 +144,7 @@ echo "No dut assigned for this test case, exiting and marking build as unstable..." exit 2 fi + TEST_ID=$(jq --arg dutid "$DUT_ID" -r '.[$dutid]' {release}-dut-test-id-mapping.json) # clone HIT and testflinger retry -t 3 -d 180 -- git clone -b $HIT_BRANCH https://oauth2:$gh_...@github.com/canonical/hardware-installer-testing.git retry -t 3 -d 180 -- git clone https://github.com/canonical/testflinger @@ -162,12 +160,55 @@ else ISO_URL="https://tel-image-cache.canonical.com/cdimage/{release}/daily-live/current/{release}-desktop-amd64.iso" fi - # call job! - # Like this for now, just to test! cd hardware-installer-testing/ - ./scripts/call_testflinger_job_w_yarf.py --test-case {test_case} --c3-machine-id $DUT_ID --iso-url $ISO_URL --github-pat-token $GH_PAT --hit-branch $HIT_BRANCH --yarf-branch main + ./scripts/call_testflinger_job_w_yarf.py --test-case {test_case} --c3-machine-id $DUT_ID --iso-url $ISO_URL --github-pat-token $GH_PAT --hit-branch $HIT_BRANCH --yarf-branch main --to-test-id $TEST_ID unstable-return: 2 publishers: - archive: artifacts: 'hardware-installer-testing/artifacts/*' allow-empty: 'true' + +- job-template: + name: 'hit-{release}-test-observer-poller' + description: | + Polls test-observer and submits an api call when all test cases are done + triggers: + - reverse: + jobs: 'hit-{release}-test-case-dut-mapping' + result: success + parameters: + - string: + name: HIT_BRANCH + default: 'installer-test-suite' + description: branch of HIT to run tests from + wrappers: + - timeout: + timeout: 180 # Needs to be long, in the case that multiple installer tests are in front in the queue + fail: true + - workspace-cleanup + - timestamps + - credentials-binding: + - text: + credential-id: GH_PAT + variable: GH_PAT + builders: + - clear-artifacts + - copyartifact: + project: 'hit-{release}-test-case-dut-mapping' + filter: '{release}-test-case-dut-mapping.json' + which-build: last-successful + - copyartifact: + project: 'hit-{release}-test-case-dut-mapping' + filter: '{release}-dut-test-id-mapping.json' + which-build: last-successful + - shell: | + #!/bin/bash + set -ex + # clone HIT and testflinger + retry -t 3 -d 180 -- git clone -b $HIT_BRANCH https://oauth2:$gh_...@github.com/canonical/hardware-installer-testing.git + # set up venv + python3 -m venv env + . env/bin/activate + pip install -r hardware-installer-testing/requirements.txt + ./hardware-installer-testing/scripts/poller.py --dut-id-mapping {release}-dut-test-id-mapping.json --test-case-dut-mapping {release}-test-case-dut-mapping +
-- Mailing list: https://launchpad.net/~canonical-ubuntu-qa Post to : canonical-ubuntu-qa@lists.launchpad.net Unsubscribe : https://launchpad.net/~canonical-ubuntu-qa More help : https://help.launchpad.net/ListHelp