Repository navigation
118 lines (102 loc) · 5.2 KB
/
Copy pathcompat.yml
File metadata and controls
118 lines (102 loc) · 5.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Compat
# Whether a checkpoint the newest release saved resumes on this change's machine, and whether the
# fingerprint still accounts for every ROM the machine maps (boot:compat, boot:roms): after every
# change on main to what a resumed guest is loaded into - the machine's definition, QEMU, the
# kernel, the firmware and their pins - and before every release. And whether that kernel, booted,
# is locked down (boot:lockdown).
#
# On the KVM fleet (spin-stack/ci), because it boots: the newest release is unpacked as the machine
# before, and the machine here is that tree with this change's QEMU, firmware and kernel built over
# it - the base image is the release's, since a checkpoint resumes with the disks it was saved
# with. The builds read the BuildKit cache main's lanes export (--cache-registry), so a
# change that leaves QEMU and the kernel alone compiles neither.
#
# The test holds the promise only where it is made: when the two fingerprints differ the contract
# moved on purpose, the test says so and passes, and the release notes say it for the fleet.
#
# Not on a pull request: it is main's and a release's lane, and a branch is tried by dispatch
# before its pull request merges. It runs on main after a merge that touches the machine, and as
# a job release.yml waits for, so no release is published that a checkpoint of the one before it
# does not resume on.
on:
push:
branches: [main]
paths:
- machine/**
- cmd/spin-machine/**
- qemu/**
- kernel/**
- boot/compat_test.go
- boot/roms_test.go
- boot/lockdown_test.go
- boot/testdata/lockdown-check.sh
- versions.yaml
- .github/workflows/compat.yml
workflow_dispatch:
workflow_call:
permissions:
contents: read
# The BuildKit cache main's lanes write (internal/build.CacheRegistry).
packages: read
# Per ref and never cancelled: a run on main is a commit somebody needs the answer for, and a
# release's waits on it. Called from release.yml it is the release's job and takes its group.
concurrency:
group: compat-${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: false
# As ci.yml: go-tools' downloads ask GitHub with it, which sheds anonymous ones first.
env:
GITHUB_TOKEN: ${{ github.token }}
jobs:
compat:
runs-on: runs-on/fleet=kvm/env=production
timeout-minutes: 120
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# Go's caches come back from the fleet's cache (its S3 bucket): the instance starts with
# nothing.
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
# A builder that can read a cache Docker's own cannot.
- name: A BuildKit that reads the lanes' cache
run: go tool task boot:buildkit
# The cache is one of this repository's packages, and reading it takes a login: without one
# BuildKit carries on without the cache and compiles QEMU and the kernel cold.
- name: Log in to GitHub Packages
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# spin-machine-dev built and on the PATH, so a step's exit status is the verb's (go run makes
# it 1): the verbs below are the ones a person types (docs/cli.md).
- name: spin-machine-dev
run: go tool task bin
# The guests' vsock transport, loaded and made this user's: a module on the fleet's kernel
# that nothing loads before the first QEMU opens /dev/vhost-vsock.
- name: Load vhost_vsock
run: spin-machine-dev vsock
# Reads the lanes' caches and writes none back: main's lanes keep them current.
- name: Build this change's QEMU and kernel, and the tools
run: spin-machine-dev build qemu kernel spin-machine --cache-registry --cache-export=false
# The newest release, checked against its sha256 and its signature, as the machine before;
# this change's machine is the same tree with what was just built in place of its own. The
# steps after boot that tree: it is their SPIN_MACHINE_OUTPUT.
- name: The machine before, and this one
run: go tool task boot:here
- name: Every ROM the machine maps is the fingerprint's
run: go tool task boot:roms
# Every release since the contract last moved, not only the one before: a host may skip
# releases, and its checkpoints still resume.
- name: A checkpoint of every release since the contract moved resumes here
run: spin-machine-dev lab compat --here "$SPIN_MACHINE_OUTPUT"
# This change's kernel, booted: lockdown at confidentiality that root cannot lower, the BPF
# LSM, no /dev/mem or /proc/kcore, and _text at a random address. kernel/Dockerfile checks
# the config; this checks the kernel that came out of it. boot:here gives the tree this
# change's bzImage and spin-machine, so it is entered the way this change enters it.
- name: The kernel is locked down
run: go tool task boot:lockdown