90 lines
2.3 KiB
Markdown
90 lines
2.3 KiB
Markdown
# Build Automation
|
|
|
|
## System Prerequisites
|
|
|
|
Before setting up automation, ensure the controlplane has bhyve support installed:
|
|
|
|
```sh
|
|
sudo pkg install edk2-bhyve
|
|
```
|
|
|
|
This is required for testing the ISO in bhyve VMs before deployment.
|
|
|
|
---
|
|
|
|
## Primary: cron job on controlplane
|
|
|
|
The simplest automation — runs weekly, no external dependencies.
|
|
|
|
```sh
|
|
# /etc/cron.d/clawdie-iso
|
|
# Rebuild ISO every Sunday at 03:00, publish to CMS nginx downloads
|
|
0 3 * * 0 root /home/clawdie/ai/clawdie-iso/build.sh && \
|
|
/home/clawdie/ai/clawdie-iso/scripts/publish.sh \
|
|
>> /var/log/clawdie-iso-build.log 2>&1
|
|
```
|
|
|
|
Enable:
|
|
|
|
```sh
|
|
echo '0 3 * * 0 root /home/clawdie/ai/clawdie-iso/build.sh && /home/clawdie/ai/clawdie-iso/scripts/publish.sh >> /var/log/clawdie-iso-build.log 2>&1' \
|
|
> /etc/cron.d/clawdie-iso
|
|
```
|
|
|
|
Manual trigger:
|
|
|
|
```sh
|
|
cd /home/clawdie/ai/clawdie-iso && sudo ./build.sh && sudo ./scripts/publish.sh
|
|
```
|
|
|
|
---
|
|
|
|
## Future: Forgejo Actions (push-triggered CI/CD)
|
|
|
|
When the ISO build is stable and you want push-triggered rebuilds, add a
|
|
self-hosted Forgejo runner on the controlplane. `code.smilepowered.org` is the
|
|
source of truth; Codeberg is only the public mirror.
|
|
|
|
### Install runner
|
|
|
|
```sh
|
|
pkg install forgejo-runner
|
|
# or fetch binary from the upstream Forgejo runner releases
|
|
```
|
|
|
|
### Register
|
|
|
|
1. Forgejo → `clawdie/clawdie-iso` → Settings → Actions → Runners → Create Runner → copy token
|
|
2. Run:
|
|
|
|
```sh
|
|
forgejo-runner register \
|
|
--url https://code.smilepowered.org \
|
|
--token <TOKEN> \
|
|
--name clawdie-build \
|
|
--labels freebsd \
|
|
--no-interactive
|
|
```
|
|
|
|
### Sudo scope (build.sh + publish.sh only)
|
|
|
|
```sh
|
|
cat > /usr/local/etc/sudoers.d/forgejo-runner <<EOF
|
|
forgejo-runner ALL=(root) NOPASSWD: /home/clawdie/ai/clawdie-iso/build.sh
|
|
forgejo-runner ALL=(root) NOPASSWD: /home/clawdie/ai/clawdie-iso/scripts/publish.sh
|
|
EOF
|
|
chmod 440 /usr/local/etc/sudoers.d/forgejo-runner
|
|
```
|
|
|
|
### Enable rc.d service
|
|
|
|
```sh
|
|
sysrc forgejo_runner_enable=YES
|
|
service forgejo-runner start
|
|
```
|
|
|
|
### Add workflow file
|
|
|
|
Once the runner is online, add `.forgejo/workflows/build.yml` to trigger builds
|
|
on push to main and weekly on schedule. See git history for the workflow template
|
|
(commit message: `feat: CI/CD pipeline, package lists, offline pkg-cache seeding`).
|