Automation
This page demonstrates different ways of creating automation around gokrazy, in two different scenarios:
-
As a user of gokrazy, who wants to automate common workflows of one or more gokrazy instances.
-
As a provider of a package that can be used with gokrazy, who wants to ensure the program(s) can be built into a gokrazy instance in a continuous integration service like GitHub Actions.
Automating common workflows with a Makefile
The make tool can be used to document and centralize common workflows.
For example, I use the following Makefile. I run make get && make update from
cron every day. I sometimes manually run
make overwrite with /dev/sdx being my USB SD card reader. And for debugging,
make root produces a SquashFS image
I can inspect with unsquashfs -ll.
The first line is the so-called “gokline”. In this line, you can centrally put all the command-line flags, environment variables or config templating hooks.
For example, in router7, I set the GOARCH=amd64
environment variable to make Go compile for x86-64 (PC) instead of ARM (Raspberry
Pi):
make: config templating
You can start templating hooks, simple or complicated, by adding them into your gokline:
I then run the following command from cron:
Continuous Integration: GitHub Actions
You can place the following gokrazy.yml into your .github/workflows
directory to verify that your program builds as a gokrazy appliance: