Capture docker inspect, /data modes, supervisorctl, and entrypoint markers on failure (stderr DEBUG816647 lines + debug-816647.log) so release CI can show why valid_hostname_starts / startup_processes_running die with empty logs. Co-Authored-By: Composer <noreply@cursor.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,9 @@ package e2e
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -46,7 +49,33 @@ func checkSupervisorProcesses(s *stack) error {
|
||||
return true, nil
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w\n==== selfpost logs ====\n%s", err, s.logs("selfpost"))
|
||||
logs := s.logs("selfpost")
|
||||
// #region agent log
|
||||
ps, _ := s.compose("ps", "-a", "--format", "json")
|
||||
inspectOut, _ := exec.Command("docker", "ps", "-a", "--filter", "name=selfpost-e2e",
|
||||
"--format", "{{.Names}} {{.Status}} {{.ID}}").CombinedOutput()
|
||||
dataPath := filepath.Join(s.stageDir, "data")
|
||||
dataMode := ""
|
||||
if fi, e := os.Stat(dataPath); e == nil {
|
||||
dataMode = fmt.Sprintf("%04o", fi.Mode().Perm())
|
||||
}
|
||||
entrypointSnippet, _ := exec.Command("docker", "run", "--rm", "--entrypoint", "sh", "selfpost:e2e",
|
||||
"-c", "grep -n 'chmod 755 /data\\|SELFPOST_HOSTNAME is not set' /usr/local/bin/entrypoint.sh | head -20").CombinedOutput()
|
||||
agentDebugLog("H4", "process_check.go:fail", "compose selfpost not ready", map[string]any{
|
||||
"waitErr": err.Error(),
|
||||
"logsLen": len(logs),
|
||||
"logsHead": truncateForDebug(logs, 4000),
|
||||
"composePs": truncateForDebug(string(ps), 2000),
|
||||
"dockerPs": strings.TrimSpace(string(inspectOut)),
|
||||
"hostDataMode": dataMode,
|
||||
"entrypointSnippets": strings.TrimSpace(string(entrypointSnippet)),
|
||||
})
|
||||
agentDebugLog("H5", "process_check.go:fail", "image entrypoint markers", map[string]any{
|
||||
"snippet": strings.TrimSpace(string(entrypointSnippet)),
|
||||
})
|
||||
// #endregion
|
||||
return fmt.Errorf("%w\n==== selfpost logs ====\n%s\n==== docker ps ====\n%s\n==== entrypoint markers ====\n%s",
|
||||
err, logs, inspectOut, entrypointSnippet)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user