Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,29 @@ jobs:
dl-${{ matrix.board }}-
dl-

# keys/dev/ is gitignored, so a runner never has it. The same CA must sign every CI image, or
# a device flashed from one run could not install a bundle made from another.
- name: Install signing material
shell: bash
env:
OTA_KEYRING_PEM: ${{ secrets.OTA_KEYRING_PEM }}
OTA_SIGNING_CERT_PEM: ${{ secrets.OTA_SIGNING_CERT_PEM }}
OTA_SIGNING_KEY_PEM: ${{ secrets.OTA_SIGNING_KEY_PEM }}
run: |
if [ -z "$OTA_KEYRING_PEM" ] || [ -z "$OTA_SIGNING_CERT_PEM" ] || [ -z "$OTA_SIGNING_KEY_PEM" ]; then
echo "::error::Secrets OTA_KEYRING_PEM, OTA_SIGNING_CERT_PEM and OTA_SIGNING_KEY_PEM must all be set (contents of keys/dev/dev-ca.cert.pem, dev-signing.cert.pem, dev-signing.key.pem)."
exit 1
fi
umask 077
mkdir -p keys/dev
printf '%s\n' "$OTA_KEYRING_PEM" > keys/dev/dev-ca.cert.pem
printf '%s\n' "$OTA_SIGNING_CERT_PEM" > keys/dev/dev-signing.cert.pem
printf '%s\n' "$OTA_SIGNING_KEY_PEM" > keys/dev/dev-signing.key.pem
# Fails here, not an hour into the build, if a secret holds something other than the pair.
openssl verify -CAfile keys/dev/dev-ca.cert.pem -purpose codesign keys/dev/dev-signing.cert.pem
test "$(openssl x509 -in keys/dev/dev-signing.cert.pem -noout -pubkey)" \
= "$(openssl pkey -in keys/dev/dev-signing.key.pem -pubout)"

- name: Build environment image
run: make docker-build

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ GitHub Actions (GitHub-hosted `ubuntu-24.04` runners):
(Actions → build → Run workflow) or when a `v*` tag is pushed, never on pull requests. The
downloaded sources in `dl/` are cached between runs. Each board's `sdcard.img.xz` is kept as a
workflow artifact for 14 days. On a tag, if every board built, a **draft** release is created
with the images and `SHA256SUMS`.
with the images and `SHA256SUMS`. `keys/dev/` is not in the repository, so `build.yml` writes it from
three repository secrets, `OTA_KEYRING_PEM`, `OTA_SIGNING_CERT_PEM` and `OTA_SIGNING_KEY_PEM` (the
contents of `dev-ca.cert.pem`, `dev-signing.cert.pem` and `dev-signing.key.pem`), and fails at once if
one is missing or the certificate does not match the key. Every CI image then shares the CA of your
local builds.

A green build is **not** a boot test. Boot each image on hardware to a login prompt on the serial
console before publishing a draft release. Images are xz-compressed: see Flashing below. Release
Expand Down
3 changes: 2 additions & 1 deletion specs/001-ci-cd-pipeline/contracts/workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
1. **boards**: derive the board list from `configs/*_defconfig`; output JSON array; fail if empty.
2. **build** (`needs: boards`, matrix `board`, `fail-fast: false`, `timeout-minutes: 350`):
checkout (submodules recursive, full history and tags so the image `VERSION` is meaningful) ->
free runner disk -> restore `dl/` cache -> `make docker-build` -> build board in container ->
free runner disk -> restore `dl/` cache -> write `keys/dev/` from the secrets
`OTA_KEYRING_PEM`, `OTA_SIGNING_CERT_PEM`, `OTA_SIGNING_KEY_PEM` and verify the pair -> `make docker-build` -> build board in container ->
compress image, write `SHA256SUMS`, copy `build-info` -> upload artifact `<board>-image`
(retention 14 days) -> save `dl/` cache (`if: always()`) -> on failure, print disk usage and an
error naming the exceeded limit. Writes a job summary with image size and elapsed time.
Expand Down