feat(builder): boots as nodes run them, fixed-size model requests, safety check, repairs #25
No files matched your search
@@ -21,6 +21,20 @@ func agentImageFromEnv() string {
|
||||
return defaultAgentImage
|
||||
}
|
||||
|
||||
// pullAgentImage fetches the latest node-agent image. A copy that is only local (a test build) is used as
|
||||
// it is.
|
||||
func pullAgentImage(img string) error {
|
||||
out, err := runCmd("docker", "pull", "-q", img)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
if _, inspectErr := runCmd("docker", "image", "inspect", img); inspectErr == nil {
|
||||
fmt.Printf("[agent] could not pull %s (%s); using the local copy\n", img, firstLine(out))
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("docker pull %s: %v: %s", img, err, out)
|
||||
}
|
||||
|
||||
// runAgentBootTest deploys a payload with BootTest and returns its output; passed is its verdict.
|
||||
func runAgentBootTest(payload map[string]any, agentImage string) (output string, passed bool, err error) {
|
||||
container := fmt.Sprint(payload["containerName"])
|
||||
|
||||
@@ -255,8 +255,8 @@ func firstBoot(name, image, steamApp string, steam bool, startup string) (*bootR
|
||||
// bootCheck deploys the template with the node-agent's BootTest, the same check CI runs, and when the
|
||||
// game wrote files outside its volume on the first boot, boots it once more to see that it no longer does.
|
||||
func bootCheck(gamesDir, id, agentImage string, wantOutside bool) (problems, verified []string, err error) {
|
||||
if out, err := runCmd("docker", "pull", "-q", agentImage); err != nil {
|
||||
return nil, nil, fmt.Errorf("docker pull %s: %v: %s", agentImage, err, out)
|
||||
if err := pullAgentImage(agentImage); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
output, passed, problems, err := agentBoot(gamesDir, id, agentImage, false)
|
||||
if err != nil || problems != nil {
|
||||
|
||||
@@ -146,8 +146,8 @@ func runFirstBoot(args []string) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if out, err := runCmd("docker", "pull", "-q", b.agentImage); err != nil {
|
||||
return fmt.Errorf("docker pull %s: %v: %s", b.agentImage, err, out)
|
||||
if err := pullAgentImage(b.agentImage); err != nil {
|
||||
return err
|
||||
}
|
||||
if !*keep {
|
||||
defer b.cleanup()
|
||||
|
||||
Reference in new issue
Block a user