← Back to team overview

canonical-hw-cert team mailing list archive

[Merge] ~kevinyeh/hwcert-jenkins-jobs:add-checkbox-snap-for-sru into hwcert-jenkins-jobs:master

 

Kevin Yeh has proposed merging ~kevinyeh/hwcert-jenkins-jobs:add-checkbox-snap-for-sru into hwcert-jenkins-jobs:master.

Commit message:
Add: allow SRU testing using checkbox snap
  add checkbox_snap for checking that job is using snap or deb
  add checkbox_snap_name let job is able to install checkbox-project snap
  add checkbox_snap_runtime for installing different version of checkbox runtime
  add checkbox_snap_channel for installing checkbox from different channel
  add checkbox_snap_track for installing checkbox from different track

Requested reviews:
  hwcert-jenkins (hwcert-jenkins)

For more details, see:
https://code.launchpad.net/~kevinyeh/hwcert-jenkins-jobs/+git/hwcert-jenkins-jobs/+merge/429501
-- 
Your team hwcert-jenkins is requested to review the proposed merge of ~kevinyeh/hwcert-jenkins-jobs:add-checkbox-snap-for-sru into hwcert-jenkins-jobs:master.
diff --git a/jobs/sru/run-sru.sh b/jobs/sru/run-sru.sh
index 12bcd4b..65a6789 100644
--- a/jobs/sru/run-sru.sh
+++ b/jobs/sru/run-sru.sh
@@ -155,31 +155,42 @@ cat > job.yaml <<EOF
         _run sudo fuser -v /var/cache/debconf/config.dat
         _run sudo apt-get -qq purge -y appstream
 
-        echo "Set up x86 basic packages, e.g. checkbox etc...."
-        # Remove checkbox first if it's already there, and remove checkbox-dev ppa
-        _run sudo apt-get -qq purge -y checkbox-ng
-        _run sudo apt-get -qq purge -y python3-checkbox-ng
-        _run sudo apt-get -qq purge -y python3-checkbox-support
-        _run sudo apt-get -qq purge -y plainbox-provider-*
-        _run sudo apt-get -qq purge -y checkbox-provider-*
-        _run sudo add-apt-repository --remove -y ppa:checkbox-dev/ppa
-
-        _run "echo \"postfix postfix/mailname string \$(hostname)\" | sudo debconf-set-selections"
-        _run "echo  \"postfix postfix/main_mailer_type string 'Internet Site'\" | sudo debconf-set-selections"
-        _run sudo add-apt-repository {checkbox_ppa} -y
-        _run sudo apt-get -qq update
-        _run sudo /home/ubuntu/wait-resource.sh
-        _run sudo fuser -v /var/lib/apt/lists/lock
-        _run sudo fuser -v /var/lib/dpkg/lock
-        _run sudo fuser -v /var/cache/debconf/config.dat
-        _run sudo DEBIAN_FRONTEND={debian_frontend} apt-get -qq install -o Dpkg::Options::="--force-confdef" -y --force-yes checkbox-ng python3-checkbox-ng plainbox-provider-checkbox plainbox-provider-resource-generic plainbox-provider-sru fswebcam obexftp wmctrl iperf mesa-utils vim pastebinit fwts xorg-dev gir1.2-clutter-1.0
+        if [ "{checkbox_snap}" == False ]; then
+            echo "Set up x86 basic packages, e.g. checkbox etc...."
+            # Remove checkbox first if it's already there, and remove checkbox-dev ppa
+            _run sudo apt-get -qq purge -y checkbox-ng
+            _run sudo apt-get -qq purge -y python3-checkbox-ng
+            _run sudo apt-get -qq purge -y python3-checkbox-support
+            _run sudo apt-get -qq purge -y plainbox-provider-*
+            _run sudo apt-get -qq purge -y checkbox-provider-*
+            _run sudo add-apt-repository --remove -y ppa:checkbox-dev/ppa
+
+            _run "echo \"postfix postfix/mailname string \$(hostname)\" | sudo debconf-set-selections"
+            _run "echo  \"postfix postfix/main_mailer_type string 'Internet Site'\" | sudo debconf-set-selections"
+            _run sudo add-apt-repository {checkbox_ppa} -y
+            _run sudo apt-get -qq update
+            _run sudo /home/ubuntu/wait-resource.sh
+            _run sudo fuser -v /var/lib/apt/lists/lock
+            _run sudo fuser -v /var/lib/dpkg/lock
+            _run sudo fuser -v /var/cache/debconf/config.dat
+            _run sudo DEBIAN_FRONTEND={debian_frontend} apt-get -qq install -o Dpkg::Options::="--force-confdef" -y --force-yes checkbox-ng python3-checkbox-ng plainbox-provider-checkbox plainbox-provider-resource-generic plainbox-provider-sru fswebcam obexftp wmctrl iperf mesa-utils vim pastebinit fwts xorg-dev gir1.2-clutter-1.0
         
-        # Phoronix Test Suite provider is only available for some releases
-        if [[ {arch} = amd64 ]] && [[ {series} =~ ^(xenial|bionic)$ ]]; then
-            _run sudo apt-get install -y checkbox-provider-phoronix libssl1.1
-            echo "Preparing the PTS cache"
-            _run mkdir /var/tmp/pts-cache
-            _run "wget -qO- {cert-file-tel}/sru/phoronix_cache/x64/{series}/pts-cache.tar.gz |tar xz -C /var/tmp/pts-cache"
+            # Phoronix Test Suite provider is only available for some releases
+            if [[ {arch} = amd64 ]] && [[ {series} =~ ^(xenial|bionic)$ ]]; then
+                _run sudo apt-get install -y checkbox-provider-phoronix libssl1.1
+                echo "Preparing the PTS cache"
+                _run mkdir /var/tmp/pts-cache
+                _run "wget -qO- {cert-file-tel}/sru/phoronix_cache/x64/{series}/pts-cache.tar.gz |tar xz -C /var/tmp/pts-cache"
+            fi
+        else
+            # Remove checkbox snap before testing.
+            _run sudo snap remove {checkbox_snap}
+            _run sudo snap remove {checkbox_snap_runtime}
+
+            # Install checkbox snap
+            _run sudo snap install {checkbox_snap_runtime}
+            _run sudo snap install {checkbox_snap_name} --channel={checkbox_snap_track}/{checkbox_snap_channel} --classic
+            _run sudo DEBIAN_FRONTEND={debian_frontend} apt-get -qq install -o Dpkg::Options::="--force-confdef" -y --force-yes fswebcam obexftp wmctrl iperf mesa-utils vim pastebinit fwts xorg-dev gir1.2-clutter-1.0
         fi
 
         if [ "{enable_proposed}" = "true" ]; then
diff --git a/jobs/sru/sru-template.yaml b/jobs/sru/sru-template.yaml
index 8e13c0e..78cbffd 100644
--- a/jobs/sru/sru-template.yaml
+++ b/jobs/sru/sru-template.yaml
@@ -73,6 +73,11 @@
     results_email: False
     results_email_tag: "TF_SRU"
     trello_reporting: True
+    checkbox_snap: False
+    checkbox_snap_name: "checkbox"
+    checkbox_snap_runtime: "checkbox20"
+    checkbox_snap_channel: "stable"
+    checkbox_snap_track: "latest"
     # the list of people interested in being spammed with SRU results_email:
     email: jonathan.cave@xxxxxxxxxxxxx
     parameters:

Follow ups