Skip to content

Commit 9061335

Browse files
Andy WhitcroftAnneCYH
authored andcommitted
reference: snap lifecycle documentation
Signed-off-by: Andy Whitcroft <apw@canonical.com>
1 parent 7c9310e commit 9061335

3 files changed

Lines changed: 145 additions & 1 deletion

File tree

docs/.custom_wordlist.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ ACKs
44
AppArmor
55
backport
66
backported
7+
bootable
78
enablement
89
gitea
10+
initramfs
911
kconfig
1012
LEDs
1113
master
@@ -20,7 +22,9 @@ rebases
2022
respin
2123
respins
2224
selftests
25+
signoff
2326
subtree
2427
unported
28+
UKIs
2529
UKN
2630
ZFS

docs/reference/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ more.
1919

2020
```{toctree}
2121
:maxdepth: 1
22-
:caption: Kernel variants
22+
:caption: Kernel variants and snaps
2323
2424
ubuntu-kernels
2525
hwe-kernels
2626
oem-kernels
27+
snap-lifecycle
2728
```
2829

2930
```{toctree}

docs/reference/snap-lifecycle.rst

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
**************
2+
Snap lifecycle
3+
**************
4+
5+
This document aims to document the lifecycle of the various kernel snap forms.
6+
7+
Snap builds
8+
===========
9+
10+
The majority of kernels with snaps are consumed both as Debian packages and snaps.
11+
To reduce testing requirements and streamline production the same binaries are used for both forms.
12+
Due to the Ubuntu requirement for source to be included with the binaries, it is simplest to generate the binaries as part of generating the Debian binary packages and repackage those into snaps where needed.
13+
Where a kernel is to be signed this is performed during the packaging process in those Debian package builds.
14+
15+
Workflow support
16+
----------------
17+
18+
Kernel snaps are represented as a separate phase in the kernel workflow.
19+
There is a Workflow Tracker for each Debian kernel build, and a separate subordinate tracker for the snap kernel build.
20+
The snap tracker will have the Debian trackers as its parent and will proceed once that Debian tracker is complete.
21+
22+
Debian pocket usage
23+
-------------------
24+
25+
The Debian package builds flow through their own lifecycle proceeding from the ``build`` location, to ``proposed``, and onward to ``updates`` and ``security`` as testing allows.
26+
27+
Kernels in the ``build`` location are unsigned and intended for simple boot testing or for testing for signing compliance.
28+
Kernels in ``proposed`` are signed (if applicable) and formal candidates for regression and certification testing.
29+
30+
Snap risk usage
31+
---------------
32+
33+
.. list-table::
34+
:header-rows: 1
35+
36+
* - Risk (channel)
37+
- Purpose
38+
- Build source
39+
40+
* - ``edge``
41+
- Snaps are unsigned and intended for simple boot testing.
42+
- Kernel snaps are built from Debian binaries in the ``build`` location.
43+
44+
* - ``beta``
45+
- Snaps are signed and intended for certification testing.
46+
- Kernel snaps are built from Debian binaries in the ``proposed`` location.
47+
48+
Track usage
49+
-----------
50+
51+
We make heavy use of store tracks to separate series-specific snaps from each other.
52+
53+
For Ubuntu LTS releases which align with Ubuntu Core releases those tracks are typically the Ubuntu Core release years (e.g. ``24``).
54+
For interim Ubuntu releases these are the full release name (e.g. ``24.10``).
55+
56+
Where a series has a :doc:`hardware enablement kernel <hwe-kernels>`, those are placed on the HWE specific tracks (e.g. ``24-hwe``).
57+
58+
Unsigned kernels
59+
----------------
60+
61+
Unsigned kernels such as the ``pi-kernel`` will be directly generated in the Debian ``main`` package.
62+
The ``linux-image`` packages are consumed and ``ubuntu-core-initramfs`` used to generate an initramfs to accompany it.
63+
These are packaged up along with any required firmware.
64+
65+
Signed kernels
66+
--------------
67+
68+
Signed kernel such as the ``pc-kernel`` will be generated in the Debian ``main`` package, and passed through the signing pipeline as part of the Debian ``signed`` package.
69+
The ``linux-image`` packages (now generated by the ``signed`` package) are consumed and ``ubuntu-core-initramfs`` used to generate an initramfs to accompany it.
70+
These are packaged up along with any required firmware.
71+
``ubuntu-core-initramfs`` is installed and invoked as part of the kernel :spellexception:`postinst.d` handling to convert the existing ``vmlinux-<verflav>`` image into a ``kernel.efi-<verflav>`` image.
72+
73+
Kernel UKIs
74+
-----------
75+
76+
For kernels use cases which require measurement we also produce Unified Kernel Images (UKIs).
77+
That is a bootable PE executable which contains the kernel binary, an initramfs, and the kernel command line.
78+
This UKI is generated in the ``linux-signed`` package through use of an additional mode of the ``ubuntu-core-initramfs`` tooling.
79+
This process produces a single binary and is signed after it is combined via the signing pipeline.
80+
81+
Stubble kernels
82+
---------------
83+
84+
On ``arm64`` we have an additional problem.
85+
For a number of platforms, the ``dtb`` is not correctly supplied by the firmware.
86+
To handle these cases a ``stubble`` wrapper is used to detect those platforms and to inject the appropriate ``dtb`` as appropriate, then handing off control to the wrapped kernel image.
87+
The kernel image is taken from the Debian ``linux-image`` package in the normal way.
88+
The ``stubble-kernel`` package is installed and invoked as part of the kernel :spellexception:`postinst.d` handling to convert the existing ``vmlinuz-<verflav>`` image into a ``stubble.efi-<verflav>`` image.
89+
90+
Snap workflow lifecycle
91+
=======================
92+
93+
The snap workflow lifecycle runs in parallel to and interlocked with the Debian Workflow lifecycle.
94+
This ensures that the snap workflow waits for the prerequisite binaries.
95+
It also ensures that testing of both Debian packages and snap must be complete before they can progress further, finally ensuring that the Debian packages and Snaps release together.
96+
97+
Unsigned build
98+
--------------
99+
100+
When a Debian kernel build completes in the ``build`` location the ``edge`` build of the Snap is triggered.
101+
This causes an auto-crank of the snap which :spellexception:`parameterizes` the ``snapcraft.yaml`` configuration, and kicks off builds against the appropriate snap build recipe.
102+
This causes the kernel to be processed into a snap and uploaded to the snap-store.
103+
The store will automatically publish this onto the ``edge`` channel for testing.
104+
105+
Early testing
106+
-------------
107+
108+
Once published we trigger any available early testing.
109+
This includes ``boot-testing``, ``abi-testing`` and ``signing-signoff``.
110+
Once each of these is successfully completed the Debian package may progress into the signing pipeline and on into its ``proposed`` location.
111+
112+
Proposed build
113+
--------------
114+
115+
Once the Debian kernel is in its ``proposed`` location a second auto-crank is triggered to process the kernel into a snap via a second snap recipe.
116+
This causes the kernel to be uploaded to the ``beta`` channel ready for wider formal testing.
117+
118+
For signed kernels this ensures the snap on the ``beta`` channel has a signed payload.
119+
We also regenerate the snap for unsigned kernel, while this may seem redundant it allows us to perform experimental builds only to ``edge`` without disrupting the workflow once the build has progressed to ``beta``.
120+
121+
Testing
122+
-------
123+
124+
Once we have a snap on the ``beta`` channel formal testing is triggered.
125+
This includes ``certification-testing`` for the snap.
126+
Once this testing is complete the snap will be promoted to the ``candidate`` channel.
127+
128+
QA testing
129+
----------
130+
131+
Once we have a formal candidate snap this may be sent for further acceptance testing in QA.
132+
Testing for the Debian package and snap are combined and gate the further promotion of both.
133+
Promotion is further gated by any applicable signoff tasks.
134+
135+
Release
136+
-------
137+
138+
Once all gating factors, testing, signoff, and cycle boundaries are satisfied the snap will be promoted to the ``stable`` channel; this occurs in lock-step with the promotion of the Debian package to ``updates``.
139+
The Debian package may then promote further to ``security`` but there is no equivalent channel for snaps.

0 commit comments

Comments
 (0)