feat(builder): SteamCMD first for Linux servers, and fall back to the next image
A draft built on a ready-made image whose files all live outside /server (nodes keep only /server and /data) went round three times and ended as WIP, although research had also verified the game's Steam app, which SteamCMD installs straight into /server. The builder never tried it. - research reads each Steam app's OS list. When it ships a Linux server, cm2network/steamcmd goes first in the variant's images and that variant is recommended. Windows-only servers keep images with Proton or Wine first. The research prompt says the same. - build tries the variant's images in order: when no draft passes with one, the next image gets a fresh start. The first draft that boots wins; if none does, the PR gets the draft that got furthest, and its summary lists each image tried and how it went. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
274ed68cc5
commit
9f6e26bc0c
3 files changed
+196
-61
No files matched your search
@@ -39,3 +39,52 @@ func TestAppNameFromAppInfo(t *testing.T) {
|
||||
t.Errorf("got %v", m)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseAppInfoFindsLinuxServers(t *testing.T) {
|
||||
linux, ok := parseAppInfo(`"1000000"
|
||||
{
|
||||
"common"
|
||||
{
|
||||
"name" "Example Dedicated Server"
|
||||
"oslist" "windows,linux"
|
||||
}
|
||||
}`)
|
||||
if !ok || linux.name != "Example Dedicated Server" || !linux.linux {
|
||||
t.Errorf("got %+v %v", linux, ok)
|
||||
}
|
||||
// A server that only exists for Windows (needs Proton or Wine)
|
||||
windows, _ := parseAppInfo(`"common" { "name" "Example Server" "oslist" "windows" }`)
|
||||
if windows.linux {
|
||||
t.Error("windows-only app reported as linux")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithSteamCMDGoesFirstOnlyForLinuxServers(t *testing.T) {
|
||||
images := []string{"someone/example-server", "cm2network/steamcmd", "other/example"}
|
||||
got := withSteamCMD(images, true)
|
||||
if len(got) != 3 || got[0] != "cm2network/steamcmd" || got[1] != "someone/example-server" {
|
||||
t.Errorf("linux: %v", got)
|
||||
}
|
||||
got = withSteamCMD([]string{"someone/proton-example"}, false)
|
||||
if len(got) != 2 || got[1] != "cm2network/steamcmd" {
|
||||
t.Errorf("windows-only: %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRecommendPrefersTheSteamCMDVariant(t *testing.T) {
|
||||
v := []variant{
|
||||
{ID: "image", Recommended: true, Images: []string{"someone/example-server"}},
|
||||
{ID: "steam", Images: []string{"cm2network/steamcmd", "someone/example-server"}},
|
||||
{ID: "broken", Recommended: true},
|
||||
}
|
||||
recommend(v)
|
||||
if v[0].Recommended || !v[1].Recommended || v[2].Recommended {
|
||||
t.Errorf("got %+v", v)
|
||||
}
|
||||
// Without a SteamCMD variant, the model's runnable choice stands
|
||||
v = []variant{{ID: "a", Images: []string{"x/a"}}, {ID: "b", Recommended: true, Images: []string{"x/b"}}}
|
||||
recommend(v)
|
||||
if v[0].Recommended || !v[1].Recommended {
|
||||
t.Errorf("got %+v", v)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user