Skip to content

Commit 242eaaf

Browse files
aledbfclaude
andcommitted
ci: parts.yml builds on the build fleet, the traceable kernel beside the kernel
GitHub's 4-vCPU runners took 21-27 min for the kernel job cold (the kernel 10-13, then the traceable kernel 9-12 in series) and 6-9 for QEMU (parts runs 45254983345, 45267869531, 45272669299). - Every compile takes its parallelism from nproc inside its RUN. The --jobs flag, Options.Jobs and the JOBS/KERNEL_NPROC build arguments are gone: a build argument is BuildKit's cache key, so a runner-sized one gave each runner size a cache of its own. - release traceable-kernel builds only the traceable kernel and holds its config to the series' committed file. Since #721 kernel/Dockerfile refuses a release kernel whose olddefconfig moves that file, so it is the release kernel's config and compiling the release kernel to read it was wasted. - parts.yml's qemu, kernel and image jobs, and a new traceable job beside kernel, run on runs-on/fleet=build/env=production (16 vCPU). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 6fc99f7 commit 242eaaf

21 files changed

Lines changed: 147 additions & 101 deletions

File tree

‎.github/actionlint.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
self-hosted-runner:
22
labels:
33
# spin-stack/ci's fleets: kvm for compat.yml, which builds and boots; bench, one instance type,
4-
# for report.yml and lab.yml, whose boot times compare only with ones taken on the same host.
4+
# for report.yml and lab.yml, whose boot times compare only with ones taken on the same host;
5+
# build, 16 vCPU and no nested virtualization, for parts.yml, which compiles and boots nothing.
56
- runs-on/fleet=kvm/env=production
67
- runs-on/fleet=bench/env=production
8+
- runs-on/fleet=build/env=production

‎.github/workflows/compat.yml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ jobs:
148148
- name: Load vhost_vsock
149149
run: spin-machine-dev vsock
150150

151-
# Reads the lanes' caches and writes none back: main's lanes keep them current. --jobs is
152-
# the lanes' 4 and not this runner's cores: it is a build argument (JOBS, KERNEL_NPROC), so
153-
# another value is another cache key from the first RUN that follows it, and without it this
154-
# step compiled QEMU and the kernel again on every push - 8 of compat's 12 minutes, on a
155-
# release's critical path (release 44641240861, every builder RUN step uncached).
151+
# Reads the lanes' caches and writes none back: main's lanes keep them current. No build
152+
# argument depends on the runner (a compile takes its parallelism from nproc inside the RUN),
153+
# so this runner hits the lanes' cache: a runner-sized argument once missed it, and this step
154+
# compiled QEMU and the kernel again on every push - 8 of compat's 12 minutes, on a release's
155+
# critical path (release 44641240861, every builder RUN step uncached).
156156
- name: Build this change's QEMU
157157
if: needs.changed.outputs.qemu == 'true'
158-
run: spin-machine-dev build qemu --jobs 4 --cache-registry --cache-export=false
158+
run: spin-machine-dev build qemu --cache-registry --cache-export=false
159159

160160
# Main's QEMU of the pinned version, in seconds: the change does not reach it. Compiled here
161161
# it took ~4 of a run's ~10 minutes, from a cache that missed (run 44974499826).
@@ -165,7 +165,7 @@ jobs:
165165

166166
- name: Build this change's kernel
167167
if: needs.changed.outputs.kernel == 'true'
168-
run: spin-machine-dev build kernel --jobs 4 --cache-registry --cache-export=false
168+
run: spin-machine-dev build kernel --cache-registry --cache-export=false
169169

170170
# The newest release, checked against its sha256 and its signature, as the machine before;
171171
# this change's machine is the same tree with the QEMU above and the kernel built, if any,

‎.github/workflows/parts.yml‎

Lines changed: 54 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ name: Parts
99
# Each job ends in the verification that belongs to it, so a configuration that lost a device,
1010
# a kernel at a fixed address or an image with an identity baked in fails here rather than in a
1111
# VM that will not start weeks later.
12+
#
13+
# The builds run on the RunsOn build fleet (spin-stack/ci: 16 vCPU, no nested virtualization,
14+
# which nothing here boots), not GitHub's 4-vCPU runners. There, cold, the kernel job took 21-27
15+
# min, the kernel 10-13 and the traceable kernel 9-12 after it, and QEMU 6-9 (parts runs
16+
# 45254983345, 45267869531, 45272669299). A compile takes nproc inside its RUN and no build
17+
# argument names the runner's size, so the fleet, a laptop and any other runner share one cache.
18+
# `changed` and `parts` compile nothing and stay on GitHub's runners.
1219

1320
on:
1421
# No paths: `parts` has to report on every change, and `changed` below is the filter. A path
@@ -38,9 +45,8 @@ env:
3845
jobs:
3946
# Whether this change can reach each part: what each build is handed (its pins in
4047
# versions.yaml) at the base and here, and the paths it is built from. It errs towards
41-
# building. The root Taskfile is deliberately not among the paths: it holds only how many jobs
42-
# to compile with and which cache to use, so it would rebuild every part for an edit that
43-
# cannot change any of them.
48+
# building. The root Taskfile is deliberately not among the paths: no build is handed anything
49+
# from it, so it would rebuild every part for an edit that cannot change any of them.
4450
changed:
4551
runs-on: ubuntu-latest
4652
timeout-minutes: 10
@@ -83,7 +89,7 @@ jobs:
8389
qemu:
8490
needs: changed
8591
if: needs.changed.outputs.qemu == 'true'
86-
runs-on: ubuntu-latest
92+
runs-on: runs-on/fleet=build/env=production
8793
# A cold build is tens of minutes and a warm one is a cache restore, so the spread is
8894
# wide and the ceiling has to sit above the cold case. What it is really for is the
8995
# other end: a `configure` that stops on a prompt would hold a runner for six hours
@@ -129,7 +135,7 @@ jobs:
129135
env:
130136
# main's lanes write the cache back; everything else only reads it.
131137
CACHE_EXPORT: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
132-
run: spin-machine-dev build qemu --jobs 4 --cache-registry --cache-export="$CACHE_EXPORT"
138+
run: spin-machine-dev build qemu --cache-registry --cache-export="$CACHE_EXPORT"
133139

134140
# vhost-vsock is a kernel module, and the machine's vsock device cannot be created
135141
# without /dev/vhost-vsock. The runner has the node and gives the user no access to
@@ -187,7 +193,7 @@ jobs:
187193
kernel:
188194
needs: changed
189195
if: needs.changed.outputs.kernel == 'true'
190-
runs-on: ubuntu-latest
196+
runs-on: runs-on/fleet=build/env=production
191197
timeout-minutes: 180
192198
steps:
193199
- name: Checkout
@@ -225,7 +231,7 @@ jobs:
225231
env:
226232
# main's lanes write the cache back; everything else only reads it.
227233
CACHE_EXPORT: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
228-
run: spin-machine-dev build kernel --jobs 4 --cache-registry --cache-export="$CACHE_EXPORT"
234+
run: spin-machine-dev build kernel --cache-registry --cache-export="$CACHE_EXPORT"
229235

230236
# Still named vmlinux-<sha>: lab tree --kernel run:<id> finds a kernel run's artifact by that name.
231237
- name: Upload the kernel
@@ -238,17 +244,46 @@ jobs:
238244
retention-days: 30
239245
if-no-files-found: error
240246

241-
# The lab's traceable kernel, as release.yml's traceable job builds it once a release is out:
242-
# the release kernel again, from the step above's builder, and a second with lockdown forced
243-
# to none, held to the first's config less that option. Here, a change that breaks it fails
244-
# before it is released and not after, when the release has no traceable kernel and no
245-
# ledger (#558). Its own cache tag, written by main as the release kernel's is, keeps
246-
# release.yml's job warm. ~10 min more cold (parts run 45071066129); the version only names
247-
# the vmlinux, which nothing here publishes.
247+
# The lab's traceable kernel, as release.yml's traceable job builds it once a release is out: the
248+
# release kernel with lockdown forced to none, its config held to the series' committed file less
249+
# that option. Here, a change that breaks it fails before it is released and not after, when the
250+
# release has no traceable kernel and no ledger (#558). A job of its own, beside `kernel` and not
251+
# after it: since #721 the release kernel's config is the committed file to the line, so this
252+
# compiles nothing of the release kernel's, and in series the two were 9-12 min of the kernel
253+
# job's 21-27. Its own cache tag, written by main as the release kernel's is, keeps release.yml's
254+
# job warm. The version only names the vmlinux, which nothing here publishes.
255+
traceable:
256+
needs: changed
257+
if: needs.changed.outputs.kernel == 'true'
258+
runs-on: runs-on/fleet=build/env=production
259+
timeout-minutes: 180
260+
steps:
261+
- name: Checkout
262+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
263+
264+
- name: Set up Go
265+
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
266+
with:
267+
go-version-file: go.mod
268+
cache: true
269+
270+
- name: spin-machine-dev
271+
run: go tool task bin
272+
273+
# As the qemu job's: a builder that can export its cache, and the login that reads it.
274+
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
275+
276+
- name: Log in to GitHub Packages
277+
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
278+
with:
279+
registry: ghcr.io
280+
username: ${{ github.actor }}
281+
password: ${{ secrets.GITHUB_TOKEN }}
282+
248283
- name: Build the traceable kernel
249284
env:
250285
CACHE_EXPORT: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
251-
run: spin-machine-dev release traceable-kernel --version "$GITHUB_SHA" --jobs 4 --cache-registry --cache-export="$CACHE_EXPORT"
286+
run: spin-machine-dev release traceable-kernel --version "$GITHUB_SHA" --cache-registry --cache-export="$CACHE_EXPORT"
252287

253288
# The base image: ~1.5 GB of apt against a live archive. The build runs `docker run --cap-add
254289
# SYS_ADMIN` and not `docker buildx build`, because mkosi assembles a root filesystem by
@@ -258,7 +293,7 @@ jobs:
258293
image:
259294
needs: changed
260295
if: needs.changed.outputs.image == 'true'
261-
runs-on: ubuntu-latest
296+
runs-on: runs-on/fleet=build/env=production
262297
timeout-minutes: 60
263298
steps:
264299
- name: Checkout
@@ -290,7 +325,7 @@ jobs:
290325
env:
291326
# main's lanes write the cache back; everything else only reads it.
292327
CACHE_EXPORT: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
293-
run: spin-machine-dev build e2fsprogs --jobs 4 --cache-registry --cache-export="$CACHE_EXPORT"
328+
run: spin-machine-dev build e2fsprogs --cache-registry --cache-export="$CACHE_EXPORT"
294329

295330
# image/build.sh asserts what came out on the finished filesystem rather than
296331
# trusting the build that made it: that there is an /sbin/init and a /bin/sh, that
@@ -310,13 +345,13 @@ jobs:
310345
env:
311346
# main's lanes write the cache back; everything else only reads it.
312347
CACHE_EXPORT: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
313-
run: spin-machine-dev build image --jobs 4 --cache-registry --cache-export="$CACHE_EXPORT"
348+
run: spin-machine-dev build image --cache-registry --cache-export="$CACHE_EXPORT"
314349

315350
# Every part the change reaches built and verified: the one check of this workflow a ruleset
316351
# can require. A part the change does not reach is skipped, which is a pass; one that failed or
317352
# was cancelled, or a `changed` that could not say, is not.
318353
parts:
319-
needs: [changed, qemu, kernel, image]
354+
needs: [changed, qemu, kernel, traceable, image]
320355
if: ${{ always() }}
321356
runs-on: ubuntu-latest
322357
timeout-minutes: 5

‎.github/workflows/release.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
- name: Build the release
116116
env:
117117
VERSION: ${{ steps.version.outputs.version }}
118-
run: spin-machine-dev release --version "$VERSION" --jobs 4 --cache-registry --cache-export=false
118+
run: spin-machine-dev release --version "$VERSION" --cache-registry --cache-export=false
119119

120120
# What reached the machine since the release before, and its manifest. Whether that
121121
# release's checkpoints still resume is the compat job's, above, which names every
@@ -208,11 +208,11 @@ jobs:
208208
username: ${{ github.actor }}
209209
password: ${{ secrets.GITHUB_TOKEN }}
210210

211-
# The release's kernel from main's cache and the traceable one beside it, whose config is held
212-
# to the release kernel's: lockdown swapped and every other option the same. Both caches are
213-
# warm: parts.yml builds the two on every change that reaches the kernel and main writes each.
211+
# The traceable kernel, whose config is held to the release kernel's (the series' committed
212+
# file): lockdown swapped and every other option the same. Its cache is warm: parts.yml's
213+
# traceable job builds it on every change that reaches the kernel and main writes it.
214214
- name: Build the traceable kernel
215-
run: spin-machine-dev release traceable-kernel --version "$VERSION" --jobs 4 --cache-registry --cache-export=false
215+
run: spin-machine-dev release traceable-kernel --version "$VERSION" --cache-registry --cache-export=false
216216

217217
- name: Install cosign
218218
uses: sigstore/cosign-installer@756fe2d284c7292c4e9b62c8a28f1e5629c59532 # v4.1.3

‎.github/workflows/sanitize.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ jobs:
110110
# The firmware the sanitized QEMU boots with: the release's, so a machine's record is the
111111
# one the release's QEMU gives and a release's checkpoint resumes. Main publishes a QEMU only
112112
# for its own pin, so a change that reaches the release's QEMU builds it, reading main's
113-
# lanes' cache as compat.yml does (--jobs 4 is their cache key).
113+
# lanes' cache as compat.yml does.
114114
- name: Main's published QEMU, for its firmware
115115
if: needs.changed.outputs.release-qemu != 'true'
116116
run: spin-machine-dev fetch qemu
117117

118118
- name: This change's QEMU, for its firmware
119119
if: needs.changed.outputs.release-qemu == 'true'
120-
run: spin-machine-dev build qemu --jobs 4 --cache-registry --cache-export=false
120+
run: spin-machine-dev build qemu --cache-registry --cache-export=false
121121

122122
- name: Build the patched QEMU under ASan and UBSan
123123
run: go tool task sanitized

‎cmd/spin-machine-dev/build.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,21 @@ import (
2020

2121
// buildFlags are the choices a build takes.
2222
type buildFlags struct {
23-
jobs int
2423
registry bool
2524
export bool
2625
experiment string
2726
rebuild bool
2827
}
2928

3029
func (f *buildFlags) register(c *cobra.Command) {
31-
c.Flags().IntVar(&f.jobs, "jobs", 8, "compile jobs each build runs (CI: its runner's cores)")
3230
c.Flags().BoolVar(&f.registry, "cache-registry", false, "read and write BuildKit's cache in "+build.CacheRegistry+" (CI) instead of under .cache/")
3331
c.Flags().BoolVar(&f.export, "cache-export", true, "write the cache back; only main's lanes need to")
3432
c.Flags().StringVar(&f.experiment, "systemd-experiment", "", "build systemd with image/systemd/experiments/<name>.patch")
3533
c.Flags().BoolVar(&f.rebuild, "rebuild", false, "build what is named even when its manifest says it is current")
3634
}
3735

3836
func (f buildFlags) options(c *cobra.Command, w workspace) build.Options {
39-
return build.Options{Root: w.root, Out: w.out, Pins: w.pins, Jobs: f.jobs, Registry: f.registry, Export: f.export,
37+
return build.Options{Root: w.root, Out: w.out, Pins: w.pins, Registry: f.registry, Export: f.export,
4038
SystemdExperiment: f.experiment, Rebuild: f.rebuild, Stdout: c.ErrOrStderr(), Stderr: c.ErrOrStderr()}
4139
}
4240

‎cmd/spin-machine-dev/edges_test.go‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,19 +250,16 @@ func TestAShellIsSystemdIn2GiBAndTwoCPUsByDefault(t *testing.T) {
250250
}
251251
}
252252

253-
func TestABuildIsEightJobsByDefaultAndSaysWhenItCannotTellTheWorkflow(t *testing.T) {
253+
func TestABuildSaysWhenItCannotTellTheWorkflow(t *testing.T) {
254254
dir := checkout(t)
255255
src := qemuSource(t)
256-
calls := fakes(t, map[string]string{"docker": `dest=""; for a; do case "$a" in type=local,dest=*) dest=${a#type=local,dest=};; esac; done
256+
fakes(t, map[string]string{"docker": `dest=""; for a; do case "$a" in type=local,dest=*) dest=${a#type=local,dest=};; esac; done
257257
[ -n "$dest" ] && cp -r ` + src + `/bin ` + src + `/qemu "$dest"/; exit 0`})
258258
put(t, filepath.Join(dir, "qemu/Dockerfile"), "FROM x", 0o644)
259259
t.Setenv("GITHUB_OUTPUT", t.TempDir())
260260
if _, _, status := verb(t, "build", "qemu"); status != 2 {
261261
t.Errorf("a step's outputs that cannot be written: exit %d", status)
262262
}
263-
if !strings.Contains(read(t, calls), "--build-arg JOBS=8 ") {
264-
t.Errorf("the build is not eight jobs: %q", read(t, calls))
265-
}
266263
}
267264

268265
// The lab keeps its trees and results under --out, as every other verb keeps its state: relative

‎cmd/spin-machine-dev/release.go‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,15 @@ func releaseTraceableKernelCmd() *cobra.Command {
157157
Use: "traceable-kernel --version <version>",
158158
Short: "Build the lab's traceable kernel of a release into _output/release, beside it and never in it",
159159
Hidden: true,
160-
Long: `Build the release's kernel (as build kernel does, into _output) and a second one from the same
161-
source and config with lockdown forced to none instead of confidentiality, into _output/traceable,
162-
then hold the second's config to the first's: that one option swapped and every other as the
163-
release has it. Its vmlinux, which build verified as the release's (both Xen notes and a filled
164-
.data.reloc), is put in _output/release as the release's traceable kernel, to be signed and
165-
published beside the release for the lab's ledger, which reads a scheduler trace that lockdown
166-
takes away (kernel/README.md), and boots it through PVH as the release boots its own (#697). It
167-
enters no tarball and nothing spin boots.`,
160+
Long: `Build the release's kernel with lockdown forced to none instead of confidentiality, from the same
161+
source and config, into _output/traceable, and hold its config to the series' committed one
162+
(kernel/config-<series>-<arch>): that one option swapped and every other as the release has it.
163+
The release kernel is not built: its build fails unless olddefconfig leaves the committed file
164+
exactly as it is, so that file is the release kernel's config. The vmlinux, which build verified
165+
as it verifies the release's (both Xen notes and a filled .data.reloc), is put in _output/release
166+
as the release's traceable kernel, to be signed and published beside the release for the lab's
167+
ledger, which reads a scheduler trace that lockdown takes away (kernel/README.md), and boots it
168+
through PVH as the release boots its own (#697). It enters no tarball and nothing spin boots.`,
168169
Args: cobra.NoArgs,
169170
RunE: func(c *cobra.Command, _ []string) error {
170171
w, err := open()
@@ -178,16 +179,17 @@ enters no tarball and nothing spin boots.`,
178179
if err != nil {
179180
return couldNot(err)
180181
}
181-
o := f.options(c, w)
182-
if _, err := build.Make(c.Context(), o, kernel); err != nil {
182+
series, err := build.KernelSeries(w.pins)
183+
if err != nil {
183184
return couldNot(err)
184185
}
185-
t := o
186+
t := f.options(c, w)
186187
t.Out, t.Traceable = filepath.Join(w.out, "traceable"), true
187188
if _, err := build.Make(c.Context(), t, kernel); err != nil {
188189
return couldNot(err)
189190
}
190-
if err := build.TraceableConfig(filepath.Join(o.Out, "kernel", "kernel-config"), filepath.Join(t.Out, "kernel", "kernel-config")); err != nil {
191+
committed := filepath.Join(w.root, "kernel", "config-"+series+"-"+build.Arch)
192+
if err := build.TraceableConfig(committed, filepath.Join(t.Out, "kernel", "kernel-config")); err != nil {
191193
return couldNot(err)
192194
}
193195
to := filepath.Join(w.out, "release", release.TraceableVmlinux(version))

0 commit comments

Comments
 (0)