fix: check out with git, sign local builds with a test key #2

Open
Job79 wants to merge 5 commits from fix-ci-and-test-key into main
pull from: fix-ci-and-test-key
4 changed files with 37 additions and 4 deletions

No files matched your search

+14 -1
View File
@@ -19,11 +19,24 @@ on:
jobs: jobs:
os: os:
runs-on: linux runs-on: linux
# permissions lets gitea.token check out the repository and publish the
# package.
permissions:
contents: read
packages: write
steps: steps:
- name: Install tools - name: Install tools
run: dnf install -yq mkosi git-core run: dnf install -yq mkosi git-core
# Check out fetches the commit with git, which needs no Node.js and no
# action from GitHub. gitea-runner 6 removed builtin:checkout.
- name: Check out - name: Check out
uses: builtin:checkout env:
AUTH: "Authorization: token ${{ gitea.token }}"
run: |
git init -q
git -c http.extraHeader="$AUTH" fetch -q --depth 1 \
"${{ gitea.server_url }}/${{ gitea.repository }}" "${{ gitea.sha }}"
git checkout -q FETCH_HEAD
- name: Build - name: Build
env: env:
KEY: ${{ secrets.SECUREBOOT_KEY }} KEY: ${{ secrets.SECUREBOOT_KEY }}
+1
View File
@@ -1,3 +1,4 @@
mkosi.key mkosi.key
mkosi.output/ mkosi.output/
mkosi.cache/ mkosi.cache/
mkosi.local.conf
+2 -1
View File
@@ -66,7 +66,6 @@ CMD ["/sbin/init"]
END END
podman run -d --name mkosi --privileged --systemd=always -v <repo>:/repo \ podman run -d --name mkosi --privileged --systemd=always -v <repo>:/repo \
-v mkosi-cache:/root/.cache/mkosi -v mkosi-work:/var/tmp -w /repo mkosi-vm -v mkosi-cache:/root/.cache/mkosi -v mkosi-work:/var/tmp -w /repo mkosi-vm
podman exec mkosi mkosi genkey # Run this once, if there is no mkosi.key.
podman exec mkosi mkdir -p mkosi.cache podman exec mkosi mkdir -p mkosi.cache
podman exec -d -t mkosi sh -c 'mkosi -i -f \ podman exec -d -t mkosi sh -c 'mkosi -i -f \
--kernel-command-line-extra=console=ttyS0 vm -- -serial chardev:console \ --kernel-command-line-extra=console=ttyS0 vm -- -serial chardev:console \
@@ -74,6 +73,8 @@ podman exec -d -t mkosi sh -c 'mkosi -i -f \
podman exec mkosi mkosi ssh -- systemctl --failed podman exec mkosi mkosi ssh -- systemctl --failed
``` ```
- mkosi signs with the test key of `mkosi.local.conf`
([README.md](README.md#development)), with paths as the container sees them.
- `mkosi -i` keeps the image with its packages installed in `mkosi.cache/`. - `mkosi -i` keeps the image with its packages installed in `mkosi.cache/`.
Rebuilds start from it and skip installing packages. Rebuilds start from it and skip installing packages.
- The volume `mkosi-work` keeps mkosi's workspace in /var/tmp off overlayfs. - The volume `mkosi-work` keeps mkosi's workspace in /var/tmp off overlayfs.
+20 -2
View File
@@ -35,11 +35,29 @@ itself up as at first boot.
## Development ## Development
`mkosi build` signs with `mkosi.key`, the private key of `mkosi.crt`, which
only CI has (the `SECUREBOOT_KEY` secret). `mkosi genkey` won't replace
`mkosi.crt`, so local builds sign with a test key. Make one:
```sh ```sh
mkosi genkey # This is for local tests. CI uses the SECUREBOOT_KEY secret. openssl req -new -x509 -newkey rsa:2048 -nodes -subj /CN=test \
mkosi build -keyout ~/test.key -out ~/test.crt
``` ```
and point `mkosi.local.conf` at it, which mkosi reads and git ignores:
```ini
[Validation]
SecureBootKey=~/test.key
SecureBootCertificate=~/test.crt
SignExpectedPcrKey=~/test.key
SignExpectedPcrCertificate=~/test.crt
VerityKey=~/test.key
VerityCertificate=~/test.crt
```
Then run `mkosi build`.
`mkosi.output/` then holds the disk image (`agentos_<version>.raw`) and the UKI `mkosi.output/` then holds the disk image (`agentos_<version>.raw`) and the UKI
and /usr partitions that make up an update. and /usr partitions that make up an update.