Merge ~alextu/plainbox-provider-pc-sanity:mv-jobs-from-QA-grub-checking into plainbox-provider-pc-sanity:master

Proposed by Alex Tu
Status: Merged
Merged at revision: 35e188dba3c6b925f7dd7fad16c30d44c21a4239
Proposed branch: ~alextu/plainbox-provider-pc-sanity:mv-jobs-from-QA-grub-checking
Merge into: plainbox-provider-pc-sanity:master
Diff against target: 203 lines (+167/-1)
4 files modified
bin/check_grub_boothole.sh (+156/-0)
debian/gitlab-ci.yml (+1/-1)
units/pc-sanity/pc-sanity-misc.pxu (+9/-0)
units/pc-sanity/pc-sanity.pxu (+1/-0)
Reviewer Review Type Date Requested Status
StanleyHuang (community) Approve
Shih-Yuan Lee Approve
OEM Solutions Group: Engineers Pending
Review via email: mp+395356@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alex Tu (alextu) wrote :
Revision history for this message
Alex Tu (alextu) wrote :

this MP will be updated after the new MP for QA is done.
And the next step will be to remove the jobs and let QA test plan nest to existed jobs in plainbox-provider-pc-sanity

Revision history for this message
Shih-Yuan Lee (fourdollars) wrote :

LGTM

review: Approve
Revision history for this message
Alex Tu (alextu) wrote :
Revision history for this message
StanleyHuang (stanley31) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/check_grub_boothole.sh b/bin/check_grub_boothole.sh
2new file mode 100755
3index 0000000..a098368
4--- /dev/null
5+++ b/bin/check_grub_boothole.sh
6@@ -0,0 +1,156 @@
7+#!/bin/bash
8+
9+cleanup()
10+{
11+ echo "Please refer to https://docs.google.com/document/d/1EheQcQ5fzdwW_JOXz5LChqObu6di4GztkxRtVxtUYGs/edit#heading=h.ek2fnosafgow for this test case."
12+}
13+
14+trap cleanup EXIT HUP INT QUIT TERM
15+
16+case "$(lsb_release -cs)" in
17+ (focal)
18+ if ! sbverify --list "/boot/vmlinuz-$(uname -r)" | grep -oP "Secure Boot Signing (.*)"; then
19+ echo "/boot/vmlinuz-$(uname -r) has invalid signature for Secure Boot."
20+ exit 1
21+ fi
22+ TARGET_GRUB="2.04-1ubuntu26.1"
23+ case "$(uname -r)" in
24+ (5.4.0-*-generic)
25+ TARGET_KERNEL=5.4.0-31-generic
26+ ;;
27+ (5.6.0-*-oem)
28+ TARGET_KERNEL=5.6.0-1011-oem
29+ ;;
30+ (5.8.0-*-generic)
31+ TARGET_KERNEL=5.8.0-23-generic
32+ ;;
33+ (5.10.0-*-oem)
34+ TARGET_KERNEL=5.10.0-1002-oem
35+ ;;
36+ (*)
37+ echo "Linux kernel '$(uname -r)' is not in the check list yet. Please report the bug."
38+ exit 1
39+ ;;
40+ esac
41+ ;;
42+ (bionic)
43+ TARGET_GRUB="2.02-2ubuntu8.17"
44+ case "$(uname -r)" in
45+ (4.15.0-*-generic)
46+ TARGET_KERNEL=4.15.0-101-generic
47+ ;;
48+ (4.18.0-*-generic)
49+ echo "There is no valid signature for 4.18.0-*-generic kernel."
50+ exit 1
51+ ;;
52+ (4.15.0-*-oem)
53+ TARGET_KERNEL=4.15.0-1087-oem
54+ ;;
55+ (5.0.0-*-oem-osp1)
56+ TARGET_KERNEL=5.0.0-1059-oem-osp1
57+ ;;
58+ (5.0.0-*-generic)
59+ TARGET_KERNEL=5.0.0-52-generic
60+ ;;
61+ (5.3.0-*-generic)
62+ TARGET_KERNEL=5.3.0-53-generic
63+ ;;
64+ (5.4.0-*-generic)
65+ TARGET_KERNEL=5.4.0-37-generic
66+ ;;
67+ (*)
68+ echo "Linux kernel '$(uname -r)' is not in the check list yet. Please report the bug."
69+ exit 1
70+ ;;
71+ esac
72+ ;;
73+ (xenial)
74+ TARGET_GRUB="2.02~beta2-36ubuntu3.26"
75+ case "$(uname -r)" in
76+ (4.4.0-*-generic)
77+ TARGET_KERNEL=4.4.0-184-generic
78+ ;;
79+ (4.8.0-*-generic)
80+ echo "There is no valid signature for 4.8.0-*-generic kernel."
81+ exit 1
82+ ;;
83+ (4.10.0-*-generic)
84+ echo "There is no valid signature for 4.10.0-*-generic kernel."
85+ exit 1
86+ ;;
87+ (4.11.0-*-generic)
88+ echo "There is no valid signature for 4.11.0-*-generic kernel."
89+ exit 1
90+ ;;
91+ (4.13.0-*-generic)
92+ echo "There is no valid signature for 4.13.0-*-generic kernel."
93+ exit 1
94+ ;;
95+ (4.13.0-*-oem)
96+ echo "There is no valid signature for 4.13.0-*-oem kernel."
97+ exit 1
98+ ;;
99+ (4.15.0-*-generic)
100+ TARGET_KERNEL=4.15.0-101-generic
101+ ;;
102+ (*)
103+ echo "Linux kernel '$(uname -r)' is not in the check list yet. Please report the bug."
104+ exit 1
105+ ;;
106+ esac
107+ ;;
108+ (*)
109+ echo "'$(lsb_release -ds)' is not in the check list yet. Please report the bug."
110+ exit 1
111+ ;;
112+esac
113+
114+CURRENT=$(dpkg-query -W -f='${Version}\n' grub-efi-amd64)
115+
116+if [ -z "$CURRENT" ]; then
117+ echo "Can not find grub-efi-amd64 version."
118+ exit 1
119+fi
120+
121+if dpkg --compare-versions "$CURRENT" lt "$TARGET_GRUB"; then
122+ echo "GRUB version needs to be $TARGET_GRUB at least, but it is $CURRENT now."
123+ exit 1
124+fi
125+
126+if dpkg --compare-versions "$(uname -r)" lt "$TARGET_KERNEL"; then
127+ echo "Kernel version needs to be $TARGET_KERNEL at least, but it is $(uname -r) now."
128+ exit 1
129+fi
130+
131+# Check the GRUB EFI file in the recovery partition
132+if dpkg-query -W -f='${Status}\n' dell-recovery 2>&1 | grep "install ok installed" >/dev/null 2>&1; then
133+ TARGET=$(python3 -c "import Dell.recovery_common as magic; target=magic.find_partition(); print(target.decode('utf8')) if type(target) is bytes else print(target)")
134+elif dpkg-query -W -f='${Status}\n' ubuntu-recovery 2>&1 | grep "install ok installed" >/dev/null 2>&1; then
135+ TARGET=$(python3 -c "import ubunturecovery.recovery_common as magic; target=magic.find_partition('PQSERVICE'); print(target.decode('utf8')) if type(target) is bytes else print(target)")
136+else
137+ echo "There is no dell-recovery or ubuntu-recovery partition in this system."
138+ exit 0
139+fi
140+
141+DISK=$(mktemp -d)
142+
143+clean_up ()
144+{
145+ cd /
146+ umount "$DISK"
147+ rmdir "$DISK"
148+}
149+
150+trap clean_up EXIT
151+mount "$TARGET" "$DISK"
152+cd "$DISK" || exit
153+
154+for efi in efi.factory/boot/grubx64.efi efi/boot/grubx64.efi; do
155+ if [ -f "$efi" ]; then
156+ VERSION=$(strings "$efi" | grep "${TARGET_GRUB:0:12}")
157+ if dpkg --compare-versions "$VERSION" lt "$TARGET_GRUB"; then
158+ echo "The version of grubx64.efi in the recovery partition needs to be $TARGET_GRUB at least, but it is $VERSION now."
159+ exit 1
160+ fi
161+ fi
162+done
163diff --git a/debian/gitlab-ci.yml b/debian/gitlab-ci.yml
164index e1f0b35..ba821b1 100644
165--- a/debian/gitlab-ci.yml
166+++ b/debian/gitlab-ci.yml
167@@ -1,5 +1,5 @@
168 include:
169- - https://gitlab.com/alex-tu-cc/pipeline/-/raw/master/salsa-ci.yml
170+ - https://gitlab.com/hustle-ci/pipeline/-/raw/master/salsa-ci.yml
171 - https://gitlab.com/hustle-ci/pipeline/raw/master/pipeline-jobs.yml
172
173 variables:
174diff --git a/units/pc-sanity/pc-sanity-misc.pxu b/units/pc-sanity/pc-sanity-misc.pxu
175index 8b83c23..04f54e6 100644
176--- a/units/pc-sanity/pc-sanity-misc.pxu
177+++ b/units/pc-sanity/pc-sanity-misc.pxu
178@@ -1,4 +1,13 @@
179 plugin: shell
180+id: misc/generic/grub_boothole
181+user: root
182+command:
183+ check_grub_boothole.sh
184+_description:
185+ Check if kernel and grub are new enough to fix the boothole issue.
186+ https://docs.google.com/document/d/1EheQcQ5fzdwW_JOXz5LChqObu6di4GztkxRtVxtUYGs/edit#heading=h.ek2fnosafgow
187+
188+plugin: shell
189 category_id: com.canonical.plainbox::miscellanea
190 id: miscellanea/copy_submission_file
191 requires: package.name == 'dkms'
192diff --git a/units/pc-sanity/pc-sanity.pxu b/units/pc-sanity/pc-sanity.pxu
193index c06622e..b500151 100644
194--- a/units/pc-sanity/pc-sanity.pxu
195+++ b/units/pc-sanity/pc-sanity.pxu
196@@ -5,6 +5,7 @@ _description:
197 This test plan is for smoke test as sanity before release image.
198 include:
199 com.canonical.certification::somerville-installation
200+ com.canonical.certification::misc/generic/grub_boothole
201 com.canonical.certification::miscellanea/check-nvidia
202 com.canonical.certification::miscellanea/debsums
203 com.canonical.certification::miscellanea/turbostate-long-idle-c10

Subscribers

People subscribed via source and target branches