← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~r41k0u/qa-jenkins-jobs:master into qa-jenkins-jobs:master

 

Pragyansh Chaturvedi has proposed merging ~r41k0u/qa-jenkins-jobs:master into qa-jenkins-jobs:master.

Commit message:
Add RPi ISO Testing Jenkins jobs

Requested reviews:
  Canonical Platform QA Team (canonical-platform-qa)

For more details, see:
https://code.launchpad.net/~r41k0u/qa-jenkins-jobs/+git/qa-jenkins-jobs/+merge/488949
-- 
Your team Canonical Platform QA Team is requested to review the proposed merge of ~r41k0u/qa-jenkins-jobs:master into qa-jenkins-jobs:master.
diff --git a/jobs/rpi-iso-testing/jobs.yaml b/jobs/rpi-iso-testing/jobs.yaml
new file mode 100644
index 0000000..21a3729
--- /dev/null
+++ b/jobs/rpi-iso-testing/jobs.yaml
@@ -0,0 +1,210 @@
+---
+# vim: sw=4 ts=4 et
+
+# QA Jenkins Jobs
+# Copyright 2016 Canonical Ltd.
+
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
+# by the Free Software Foundation.
+
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+# PURPOSE.  See the GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License along
+# with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# The project stanza describes all jobs and parameters
+
+- project:
+    name: 'rpi-iso-testing'
+    release:
+        - 'questing'
+    dut_id:
+        - 'rpi5b8g'
+        - 'rpi5b4g'
+        - 'rpi4b8g'
+        - 'rpi4b4g'
+        - 'rpi400'
+        - 'rpicm4l'
+    test_case:
+        - '01-gui-install'
+        - '02-sleep-n-wake'
+        - '03-reboot'
+        - '04-bluetooth'
+        - '05-wifi'
+        - '06-firefox-vid-playback'
+        - '07-usb'
+        - '08-shutdown'
+    jobs:
+        - 'rpi-{release}-test-case-dut-mapping'
+        - 'rpi-{release}-desktop-{dut_id}'
+        - 'rpi-{release}-test-observer-poller'
+
+- job-template:
+    name: 'rpi-{release}-test-case-dut-mapping'
+    description: |
+        Maps testcases to DUT ids
+    node: 'iso-testing'
+    parameters:
+        - string:
+            name: 'DUT_IDS'
+            description: 'Space separated list of c3 DUT ids'
+            default:
+                !j2: '{{ " ".join(dut_id) }}'
+        - string:
+            name: 'TEST_CASES'
+            description: 'Space separated list of test case names'
+            default:
+                !j2: '{{ " ".join(test_case) }}'
+        - string:
+            name: HIT_BRANCH
+            default: 'main'
+            description: branch of HIT to run dispatcher from
+    triggers:
+        - pollurl:
+            cron: '@hourly'
+            polling-node: 'iso-testing'
+            urls:
+              - url: 'http://cdimage.ubuntu.com/daily-preinstalled/pending/.publish_info#rpi-{release}-test-case-dut-mapping'
+                check-content:
+                  - text:
+                      - '^{release}-.*.img.xz .+$'
+              - url: 'http://cdimage.ubuntu.com/{release}/daily-preinstalled/pending/.publish_info#rpi-{release}-test-case-dut-mapping'
+                check-content:
+                  - text:
+                      - '^{release}-.*.img.xz .+$'
+    wrappers:
+      - workspace-cleanup
+      - timestamps
+      - timeout:
+          timeout: 15
+          fail: true
+      - credentials-binding:
+          - text:
+              credential-id: GH_PAT
+              variable: GH_PAT
+    builders:
+        - clear-artifacts
+        - shell: |
+            #!/bin/bash
+            retry -t 3 -d 180 -- git clone -b $HIT_BRANCH https://oauth2:$GH_PAT@xxxxxxxxxx/canonical/hardware-installer-testing.git
+            python3 -m venv env
+            . env/bin/activate
+            pip install -r hardware-installer-testing/requirements.txt
+            export RELEASE={release}
+            ./hardware-installer-testing/scripts/dispatcher.py --test-observer --rpi
+    publishers:
+        - archive:
+            artifacts: '{release}-test-case-dut-mapping.json'
+        - archive:
+            artifacts: '{release}-dut-test-id-mapping.json'
+
+- job-template:
+    name: 'rpi-{release}-desktop-{dut_id}'
+    description: |
+        Runs a test case on a DUT as specified by dut-test-id-mapping
+    node: 'iso-testing'
+    triggers:
+        - reverse:
+            jobs: 'rpi-{release}-test-case-dut-mapping'
+            result: success
+    parameters:
+      - string:
+          name: HIT_BRANCH
+          default: 'main'
+          description: branch of HIT to run tests from
+    wrappers:
+      - timeout:
+          timeout: 300  # 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: 'rpi-iso-testing'
+            filter: '{release}-test-case-dut-mapping.json'
+            which-build: last-successful
+        - copyartifact:
+            project: 'rpi-iso-testing'
+            filter: '{release}-dut-test-id-mapping.json'
+            which-build: last-successful
+        - shell:
+            command: |
+                #!/bin/bash
+                set -ex
+                # clone HIT and testflinger
+                retry -t 3 -d 180 -- git clone -b $HIT_BRANCH https://oauth2:$GH_PAT@xxxxxxxxxx/canonical/hardware-installer-testing.git
+                retry -t 3 -d 180 -- git clone https://github.com/canonical/testflinger
+                # set up venv
+                python3 -m venv env
+                . env/bin/activate
+                pip install testflinger/cli
+                pip install -r hardware-installer-testing/requirements.txt
+                # determine ISO url
+                development_release=$(distro-info --devel || echo UNKNOWN)
+                if [ {release} = $development_release ]; then
+                    ISO_URL="https://tel-image-cache.canonical.com/cdimage/daily-preinstalled/pending/{release}-preinstalled-desktop-arm64+raspi.img.xz";
+                else
+                    ISO_URL="https://tel-image-cache.canonical.com/cdimage/{release}/daily-preinstalled/pending/{release}-preinstalled-desktop-arm64+raspi.img.xz";
+                fi
+                cd hardware-installer-testing/
+                ./scripts/call_testflinger_job_w_yarf.py --release {release} --rpi --c3-machine-id {dut_id} --iso-url $ISO_URL --github-pat-token $GH_PAT --hit-branch $HIT_BRANCH --yarf-branch main
+            unstable-return: 2
+    publishers:
+        - archive:
+            artifacts: 'rpi-iso-testing/artifacts/*'
+            allow-empty: 'true'
+
+- job-template:
+    name: 'rpi-{release}-test-observer-poller'
+    description: |
+        Polls test-observer and submits an api call when all test cases are done
+    triggers:
+        - reverse:
+            jobs: 'rpi-{release}-test-case-dut-mapping'
+            result: success
+    node: 'iso-testing'
+    parameters:
+      - string:
+          name: HIT_BRANCH
+          default: 'main'
+          description: branch of HIT to run poller from
+    wrappers:
+      - timeout:
+          timeout: 300  # Needs to be long, in the case that multiple installer tests are in front in the queue
+          timeout-var: POLL_TIMEOUT
+          fail: true
+      - workspace-cleanup
+      - timestamps
+      - credentials-binding:
+          - text:
+              credential-id: GH_PAT
+              variable: GH_PAT
+    builders:
+        - clear-artifacts
+        - copyartifact:
+            project: 'rpi-iso-testing'
+            filter: '{release}-test-case-dut-mapping.json'
+            which-build: last-successful
+        - copyartifact:
+            project: 'rpi-iso-testing'
+            filter: '{release}-dut-test-id-mapping.json'
+            which-build: last-successful
+        - shell: |
+            #!/bin/bash
+            set -ex
+            # clone HIT
+            retry -t 3 -d 180 -- git clone -b $HIT_BRANCH https://oauth2:$GH_PAT@xxxxxxxxxx/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 --rpi --dut-id-mapping {release}-dut-test-id-mapping.json --timeout $POLL_TIMEOUT