|
| 1 | +# Flatcar automated patch ingestion |
| 2 | + |
| 3 | +* status: proposal |
| 4 | +* next step: discussion, changes / updates, collect approvals |
| 5 | +* final destination: `docs/flatcar-automated-patch-ingestion.md` |
| 6 | + |
| 7 | +The document discusses automatically ingesting package updates and patches via the Gentoo submodule. |
| 8 | +Packages in coreos-overlay are out of scope. |
| 9 | + |
| 10 | +## Ingesting Updates |
| 11 | + |
| 12 | +Flatcar uses Gentoo in a git submodule in [`sdk_container/src/third_party`](../sdk_container/src/third_party). |
| 13 | +The submodule tracks Gentoo's master branch (via an [intermediate mirror](https://github.com/flatcar-hub/gentoo/tree/master) under Flatcar control, for robustness reasons). |
| 14 | +Updates / upgrades that arrived in Gentoo can be ingested simply by rebasing the Gentoo git submodule to latest `master`. |
| 15 | + |
| 16 | +The update ingestion and patching document covers two distinct areas: |
| 17 | +1. **The `main` branch.** |
| 18 | + This branch receives updates to latest+greatest for all its packages, i.e. the latest package release marked `stable` in Gentoo will be ingested. |
| 19 | +2. **Release branches.** |
| 20 | + Release branches receive patch-level updates for all packages the release includes. |
| 21 | + Major and minor versions of all packages in release branches will be frozen when the branch is created from `main`, i.e. at the time of the Alpha release. |
| 22 | + |
| 23 | +## Automated Updates for the `main` Branch |
| 24 | + |
| 25 | +Main ingests new package versions from Gentoo in a daily cadence and can be triggered manually on demand (e.g. to fix emergent critical CVEs outside the daily rhythm). |
| 26 | +Details on ingesting these updates are outlined in "Ingestion Workflow". |
| 27 | +* Main always gets latest+greatest. |
| 28 | +* If desired, package unmasks can be added to the Flatcar profile to allow-list package versions deemed unstable in Gentoo. |
| 29 | + This is handy for helping to stabilise packages we maintain - or plan to maintain - upstream, e.g. docker/containerd/runc. |
| 30 | +* In exceptional cases, version can be freezed by temporarily moving packages from Gentoo to coreos-overlay. |
| 31 | + This should be rare and well justified (e.g. SELinux profiles). |
| 32 | + |
| 33 | +This allows for an "upstream first" development flow in which we upgrade packages and fix issues directly in upstream Gentoo. |
| 34 | + |
| 35 | +## Automated Patching of Release Branches |
| 36 | + |
| 37 | +Release branches ingest patch level updates of all packages on a daily cadence, using the same workflows and mechanisms as `main`. |
| 38 | +This is implemented by "freezing" all package major and minor versions when a new Alpha branch is created. |
| 39 | +The freeze is implemented via adding package major and minor versions to package masks / package keywords automatically at branch creation time. |
| 40 | +The package major and minor versions reflect the most current versions shipped when the branch is created. |
| 41 | + |
| 42 | +As a result, the Gentoo git submodule will automatically be rebased in release branches too, as outlined in "Ingestion Workflow", while ensuring only patch level updates will be ingested to the maintenance branches. |
| 43 | + |
| 44 | +If a package major.minor version is discontinued by Gentoo upstream, Flatcar distro maintainers need to make a qualified decision: |
| 45 | +1. Move the latest available patch level version before discontinuation to coreos-overlay. |
| 46 | + The maintenance branch will then carry that version in coreos-overlay for the lifetime of this respective major release. |
| 47 | +2. Ship a minor (or major) version upgrade of the affected package with the next OS patch-level release. |
| 48 | + This may be more desirable than 1. if the package upgrade |
| 49 | + 1. is considered low impact, e.g. shipping a new major VIM version. |
| 50 | + 2. ships important security fixes not available for older releases. |
| 51 | + |
| 52 | + |
| 53 | +## Ingestion Workflow |
| 54 | + |
| 55 | +The ingestion workflow is: |
| 56 | +1. Rebase to latest Gentoo upstream in our Gentoo mirror clone via https://github.com/flatcar-hub/gentoo/actions/workflows/auto-update.yaml. |
| 57 | +2. Create a new branch and update the Gentoo git submodule to latest mirror `master`. |
| 58 | +3. create a PR in the `scripts` repo using that branch. |
| 59 | +4. run an OS image build and qemu tests for both AMD64 and ARM64. |
| 60 | + Test results will be posted to the PR. |
| 61 | +5. create a package version diff between |
| 62 | + 1. the current build and the latest nightly |
| 63 | + 2. the current build and the latest release of the target release branch (or the latest Alpha release for `main`) |
| 64 | + and add it to the PR. |
| 65 | +6. create an OS filesystem contents diff |
| 66 | + 1. the current build and the latest nightly |
| 67 | + 2. the current build and the latest release of the target release branch (or the latest Alpha release for `main`) |
| 68 | + and add it to the PR. |
| 69 | +7. The PR is approved and merged by a maintainer based on the information provided in the PR. |
| 70 | + 1. If build or tests failed, the PR will remain open and automation will re-use the same PR for updated builds. |
| 71 | + |
| 72 | +Follow-up: The package version diffs generated in 5. may be used as a base for generating release changelog information. |
| 73 | +However, this is out of scope of this document. |
0 commit comments