Tag releases, and name the version on the Overview
nix run .#release ends by creating the annotated tag vX.Y.Z on the released commit (the tags routers that update from the repository look for); it refuses a HEAD of another version and does nothing outside a checkout. The System card on the Overview says which nixos-router and NixOS run. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -319,6 +319,8 @@ type dashboard struct {
|
||||
Events []Event
|
||||
Charts []Chart
|
||||
Prefs Prefs
|
||||
Version string // the installed release of nixos-router
|
||||
NixOS string // the NixOS it runs on
|
||||
}
|
||||
|
||||
func (a *app) dashboardData(rangeName string) dashboard {
|
||||
@@ -326,7 +328,8 @@ func (a *app) dashboardData(rangeName string) dashboard {
|
||||
now := time.Now()
|
||||
s, _ := loadSettings(a.sys.settingsPath())
|
||||
f := s.form()
|
||||
d := dashboard{Range: rg.Name, Interval: 5, Snap: a.metrics.Snapshot(), Prefs: a.sys.loadPrefs()}
|
||||
d := dashboard{Range: rg.Name, Interval: 5, Snap: a.metrics.Snapshot(), Prefs: a.sys.loadPrefs(),
|
||||
Version: a.sys.installedRelease().Version, NixOS: a.sys.runningVersion()}
|
||||
// Newest first, the last few.
|
||||
ev := d.Snap.Uplink.Events
|
||||
d.Events = make([]Event, 0, 10)
|
||||
|
||||
@@ -155,6 +155,25 @@ func TestDashboardRenders(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDashboardNamesTheVersion(t *testing.T) {
|
||||
a, sys := newTestApp(t)
|
||||
dir := t.TempDir()
|
||||
sys.ReleaseFile = filepath.Join(dir, "router-release")
|
||||
sys.VersionFile = filepath.Join(dir, "nixos-version")
|
||||
os.WriteFile(sys.ReleaseFile, []byte(`{"version":"4.5.6"}`), 0o600)
|
||||
os.WriteFile(sys.VersionFile, []byte("26.11.20261113.d5cc683\n"), 0o600)
|
||||
a.sys = sys
|
||||
h := a.routes()
|
||||
cookie := login(t, h)
|
||||
// The page and the fragment that refreshes it say what runs.
|
||||
for _, path := range []string{"/", "/dashboard?range=24h"} {
|
||||
body := do(h, "GET", path, nil, cookie).Body.String()
|
||||
if !strings.Contains(body, "nixos-router 4.5.6") || !strings.Contains(body, "NixOS 26.11.20261113.d5cc683") {
|
||||
t.Errorf("%s does not name the version:\n%s", path, body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestBackup(t *testing.T) {
|
||||
a, sys := newTestApp(t)
|
||||
h := a.routes()
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<section class="card">
|
||||
<h2>System</h2>
|
||||
<dl>
|
||||
{{if $d.Version}}<dt>Version</dt><dd>nixos-router {{$d.Version}}{{if $d.NixOS}} <span class="muted">on NixOS {{$d.NixOS}}</span>{{end}}</dd>{{end}}
|
||||
<dt>Uptime</dt><dd>{{age $sys.Uptime}}</dd>
|
||||
{{if $sys.Kernel}}<dt>Kernel</dt><dd>{{$sys.Kernel}}{{if $sys.KernelNext}} <span class="bad">reboot to run {{$sys.KernelNext}}</span> <button type="button" class="link" data-dialog="Reboot the router now? Routing stops for a minute or two." data-dialog-ok="Reboot" data-post="/reboot">Reboot</button>{{end}}</dd>{{end}}
|
||||
{{if $sys.BootPending}}<dt>Reboot</dt><dd><span class="bad">a new configuration starts at the next reboot</span> <button type="button" class="link" data-dialog="Reboot the router now? Routing stops for a minute or two." data-dialog-ok="Reboot" data-post="/reboot">Reboot</button></dd>{{end}}
|
||||
|
||||
Reference in New Issue
Block a user