gokrazy: add two arm64 variants for Pi & VMs
We previously had two GOARCH variants for natlab testing (gokrazy/natlabapp and gokrazy/natlabapp.arm64), but we didn't have those variants for the "tsapp" (production, not testing) variant. This adds arm64 for tsapp too. But there are two major users of arm64 for gokrazy: Raspberry Pis, and cloud VMs. So make two variants. Updates #1866 Change-Id: Ib9efaf1255101e3cdbc31d49c76fd86dcba21bb1 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
6cd185bf31
commit
638b73a68d
@@ -23,6 +23,78 @@ import (
|
||||
|
||||
var runVMTests = flag.Bool("run-vm-tests", false, "run tests that require a VM")
|
||||
|
||||
func TestTsappConfigs(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
app string
|
||||
goarch string
|
||||
kernel string
|
||||
firmware string
|
||||
eeprom string
|
||||
}{
|
||||
{
|
||||
name: "tsapp",
|
||||
app: "tsapp",
|
||||
goarch: "amd64",
|
||||
kernel: "github.com/tailscale/gokrazy-kernel",
|
||||
firmware: "github.com/tailscale/gokrazy-kernel",
|
||||
},
|
||||
{
|
||||
name: "tsapp-vm-arm64",
|
||||
app: "tsapp-vm.arm64",
|
||||
goarch: "arm64",
|
||||
kernel: "github.com/gokrazy/kernel.arm64",
|
||||
firmware: "github.com/gokrazy/kernel.arm64",
|
||||
eeprom: "",
|
||||
},
|
||||
{
|
||||
name: "tsapp-pi-arm64",
|
||||
app: "tsapp-pi.arm64",
|
||||
goarch: "arm64",
|
||||
kernel: "github.com/gokrazy/kernel.rpi",
|
||||
firmware: "github.com/gokrazy/firmware",
|
||||
eeprom: "github.com/gokrazy/rpi-eeprom",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cfgBytes, err := os.ReadFile(filepath.Join(tt.app, "config.json"))
|
||||
if err != nil {
|
||||
t.Fatalf("reading config.json: %v", err)
|
||||
}
|
||||
var cfg struct {
|
||||
Environment []string
|
||||
KernelPackage string
|
||||
FirmwarePackage string
|
||||
EEPROMPackage *string
|
||||
}
|
||||
if err := json.Unmarshal(cfgBytes, &cfg); err != nil {
|
||||
t.Fatalf("unmarshaling config.json: %v", err)
|
||||
}
|
||||
var raw map[string]json.RawMessage
|
||||
if err := json.Unmarshal(cfgBytes, &raw); err != nil {
|
||||
t.Fatalf("unmarshaling config.json as map: %v", err)
|
||||
}
|
||||
gokCfg := gokrazyConfig{Environment: cfg.Environment}
|
||||
if got := gokCfg.GOARCH(); got != tt.goarch {
|
||||
t.Errorf("GOARCH = %q; want %q", got, tt.goarch)
|
||||
}
|
||||
if cfg.KernelPackage != tt.kernel {
|
||||
t.Errorf("KernelPackage = %q; want %q", cfg.KernelPackage, tt.kernel)
|
||||
}
|
||||
if cfg.FirmwarePackage != tt.firmware {
|
||||
t.Errorf("FirmwarePackage = %q; want %q", cfg.FirmwarePackage, tt.firmware)
|
||||
}
|
||||
if _, ok := raw["EEPROMPackage"]; tt.goarch == "arm64" && !ok {
|
||||
t.Error("EEPROMPackage is missing")
|
||||
}
|
||||
if cfg.EEPROMPackage != nil && *cfg.EEPROMPackage != tt.eeprom {
|
||||
t.Errorf("EEPROMPackage = %q; want %q", *cfg.EEPROMPackage, tt.eeprom)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func findKernelPath(t *testing.T) string {
|
||||
t.Helper()
|
||||
goModPath := filepath.Join("..", "go.mod")
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Tailscale Appliance Raspberry Pi arm64
|
||||
|
||||
This is the Raspberry Pi arm64 variant of the Gokrazy Tailscale Appliance image.
|
||||
See ../tsapp/README.md for more info.
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"Hostname": "tsapp",
|
||||
"Update": {
|
||||
"NoPassword": true
|
||||
},
|
||||
"SerialConsole": "ttyS0,115200",
|
||||
"GokrazyPackages": [
|
||||
"github.com/gokrazy/gokrazy/cmd/dhcp",
|
||||
"github.com/gokrazy/gokrazy/cmd/randomd",
|
||||
"github.com/gokrazy/gokrazy/cmd/ntp"
|
||||
],
|
||||
"Packages": [
|
||||
"github.com/gokrazy/serial-busybox",
|
||||
"github.com/gokrazy/breakglass",
|
||||
"tailscale.com/cmd/tailscale",
|
||||
"tailscale.com/cmd/tailscaled"
|
||||
],
|
||||
"PackageConfig": {
|
||||
"github.com/gokrazy/breakglass": {
|
||||
"CommandLineFlags": [
|
||||
"-authorized_keys=ec2"
|
||||
]
|
||||
},
|
||||
"tailscale.com/cmd/tailscale": {
|
||||
"ExtraFilePaths": {
|
||||
"/usr": "usr-dir"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Environment": [
|
||||
"GOOS=linux",
|
||||
"GOARCH=arm64"
|
||||
],
|
||||
"KernelPackage": "github.com/gokrazy/kernel.rpi",
|
||||
"FirmwarePackage": "github.com/gokrazy/firmware",
|
||||
"EEPROMPackage": "github.com/gokrazy/rpi-eeprom",
|
||||
"InternalCompatibilityFlags": {
|
||||
"InitImportPath": "github.com/tailscale/ts-gokrazy/gokrazyinit"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Copyright (c) Tailscale Inc & contributors
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build for_go_mod_tidy_only
|
||||
|
||||
package gokrazydeps
|
||||
|
||||
import (
|
||||
_ "github.com/gokrazy/breakglass"
|
||||
_ "github.com/gokrazy/firmware"
|
||||
_ "github.com/gokrazy/gokrazy/cmd/dhcp"
|
||||
_ "github.com/gokrazy/gokrazy/cmd/ntp"
|
||||
_ "github.com/gokrazy/gokrazy/cmd/randomd"
|
||||
_ "github.com/gokrazy/kernel.rpi"
|
||||
_ "github.com/gokrazy/rpi-eeprom"
|
||||
_ "github.com/gokrazy/serial-busybox"
|
||||
_ "github.com/tailscale/ts-gokrazy/gokrazyinit"
|
||||
_ "tailscale.com/cmd/tailscale"
|
||||
_ "tailscale.com/cmd/tailscaled"
|
||||
)
|
||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
# Tailscale Appliance VM arm64
|
||||
|
||||
This is the arm64 VM variant of the Gokrazy Tailscale Appliance image.
|
||||
See ../tsapp/README.md for more info.
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"Hostname": "tsapp",
|
||||
"Update": {
|
||||
"NoPassword": true
|
||||
},
|
||||
"SerialConsole": "ttyS0,115200",
|
||||
"GokrazyPackages": [
|
||||
"github.com/gokrazy/gokrazy/cmd/dhcp",
|
||||
"github.com/gokrazy/gokrazy/cmd/randomd",
|
||||
"github.com/gokrazy/gokrazy/cmd/ntp"
|
||||
],
|
||||
"Packages": [
|
||||
"github.com/gokrazy/serial-busybox",
|
||||
"github.com/gokrazy/breakglass",
|
||||
"tailscale.com/cmd/tailscale",
|
||||
"tailscale.com/cmd/tailscaled"
|
||||
],
|
||||
"PackageConfig": {
|
||||
"github.com/gokrazy/breakglass": {
|
||||
"CommandLineFlags": [
|
||||
"-authorized_keys=ec2"
|
||||
]
|
||||
},
|
||||
"tailscale.com/cmd/tailscale": {
|
||||
"ExtraFilePaths": {
|
||||
"/usr": "usr-dir"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Environment": [
|
||||
"GOOS=linux",
|
||||
"GOARCH=arm64"
|
||||
],
|
||||
"KernelPackage": "github.com/gokrazy/kernel.arm64",
|
||||
"FirmwarePackage": "github.com/gokrazy/kernel.arm64",
|
||||
"EEPROMPackage": "",
|
||||
"InternalCompatibilityFlags": {
|
||||
"InitImportPath": "github.com/tailscale/ts-gokrazy/gokrazyinit"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) Tailscale Inc & contributors
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build for_go_mod_tidy_only
|
||||
|
||||
package gokrazydeps
|
||||
|
||||
import (
|
||||
_ "github.com/gokrazy/breakglass"
|
||||
_ "github.com/gokrazy/gokrazy/cmd/dhcp"
|
||||
_ "github.com/gokrazy/gokrazy/cmd/ntp"
|
||||
_ "github.com/gokrazy/gokrazy/cmd/randomd"
|
||||
_ "github.com/gokrazy/kernel.arm64"
|
||||
_ "github.com/gokrazy/serial-busybox"
|
||||
_ "github.com/tailscale/ts-gokrazy/gokrazyinit"
|
||||
_ "tailscale.com/cmd/tailscale"
|
||||
_ "tailscale.com/cmd/tailscaled"
|
||||
)
|
||||
Binary file not shown.
Reference in New Issue
Block a user