From 6beefcca69306e1a03aabc791c6c2dd12e8beaf0 Mon Sep 17 00:00:00 2001 From: Leon Adomaitis <47161699+GunniBusch@users.noreply.github.com> Date: Wed, 31 Dec 2025 00:47:12 +0100 Subject: [PATCH 1/2] Add SHA256SUMS to release artifacts --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9e020b..2cf5c22 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -91,5 +91,6 @@ jobs: files: | artifacts/* docs/* + SHA256SUMS env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 8aa88e7193136c7b2eeae2c95980f5b94fdfd2c3 Mon Sep 17 00:00:00 2001 From: Pranshu Parmar Date: Wed, 31 Dec 2025 04:27:04 +0000 Subject: [PATCH 2/2] Fix #63: Enhanced container detection --- README.md | 6 +++--- internal/proc/process_darwin.go | 15 +++++++++------ internal/proc/process_linux.go | 15 ++++++++++----- internal/source/container.go | 33 ++++++++++++++++++++++++++++----- internal/source/source.go | 4 +++- internal/source/supervisor.go | 12 ++++++++++++ 6 files changed, 65 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index f23bcd7..d975383 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ Only **one primary source** is selected. - Working directory - Git repository name and branch -- Docker container name / image +- Container name / image (docker, podman, kubernetes, colima, containerd) - Public vs private bind #### Warnings @@ -496,14 +496,14 @@ nix run github:pranshuparmar/witr -- --port 5000 | launchd | ❌ | ✅ | macOS only | | Supervisor | ✅ | ✅ | | | Cron | ✅ | ✅ | | -| Docker/containers | ✅ | ⚠️ | macOS: Docker Desktop runs in VM | +| Containers | ✅ | ⚠️ | macOS: Docker Desktop, Podman, Colima run in VM | | **Health & Diagnostics** | | CPU usage detection | ✅ | ✅ | | | Memory usage detection | ✅ | ✅ | | | Zombie process detection | ✅ | ✅ | | | **Context** | | Git repo/branch detection | ✅ | ✅ | | -| Container detection | ✅ | ⚠️ | macOS: limited to Docker Desktop | +| Container detection | ✅ | ⚠️ | macOS: limited to Docker Desktop, Podman, Colima | **Legend:** ✅ Full support | ⚠️ Partial/limited support | ❌ Not available diff --git a/internal/proc/process_darwin.go b/internal/proc/process_darwin.go index 4567b97..39efc94 100644 --- a/internal/proc/process_darwin.go +++ b/internal/proc/process_darwin.go @@ -209,14 +209,17 @@ func detectContainer(pid int) string { cmdline := getCommandLine(pid) lowerCmd := strings.ToLower(cmdline) - if strings.Contains(lowerCmd, "docker") { + switch { + case strings.Contains(lowerCmd, "docker"): return "docker" - } - if strings.Contains(lowerCmd, "containerd") { - return "containerd" - } - if strings.Contains(lowerCmd, "colima") { + case strings.Contains(lowerCmd, "podman"): + return "podman" + case strings.Contains(lowerCmd, "kubepods"): + return "kubernetes" + case strings.Contains(lowerCmd, "colima"): return "colima" + case strings.Contains(lowerCmd, "containerd"): + return "containerd" } return "" diff --git a/internal/proc/process_linux.go b/internal/proc/process_linux.go index 27647e5..44138a7 100644 --- a/internal/proc/process_linux.go +++ b/internal/proc/process_linux.go @@ -34,17 +34,22 @@ func ReadProcess(pid int) (model.Process, error) { cwd = "unknown" } - // Container detection (simple: look for docker/containerd/kubepods in cgroup) + // Container detection container := "" cgroupFile := fmt.Sprintf("/proc/%d/cgroup", pid) if cgroupData, err := os.ReadFile(cgroupFile); err == nil { cgroupStr := string(cgroupData) - if strings.Contains(cgroupStr, "docker") { + switch { + case strings.Contains(cgroupStr, "docker"): container = "docker" - } else if strings.Contains(cgroupStr, "containerd") { - container = "containerd" - } else if strings.Contains(cgroupStr, "kubepods") { + case strings.Contains(cgroupStr, "podman"): + container = "podman" + case strings.Contains(cgroupStr, "kubepods"): container = "kubernetes" + case strings.Contains(cgroupStr, "colima"): + container = "colima" + case strings.Contains(cgroupStr, "containerd"): + container = "containerd" } } diff --git a/internal/source/container.go b/internal/source/container.go index 8529572..8b1f91d 100644 --- a/internal/source/container.go +++ b/internal/source/container.go @@ -16,15 +16,38 @@ func detectContainer(ancestry []model.Process) *model.Source { } content := string(data) - if strings.Contains(content, "docker") || - strings.Contains(content, "containerd") || - strings.Contains(content, "kubepods") { - + switch { + case strings.Contains(content, "docker"): + return &model.Source{ + Type: model.SourceContainer, + Name: "docker", + Confidence: 0.9, + } + case strings.Contains(content, "podman"): + return &model.Source{ + Type: model.SourceContainer, + Name: "podman", + Confidence: 0.9, + } + case strings.Contains(content, "kubepods"): + return &model.Source{ + Type: model.SourceContainer, + Name: "kubernetes", + Confidence: 0.9, + } + case strings.Contains(content, "colima"): return &model.Source{ Type: model.SourceContainer, - Name: "container", + Name: "colima", Confidence: 0.9, } + case strings.Contains(content, "containerd"): + // Only match containerd if not already matched by docker/kubernetes/colima + return &model.Source{ + Type: model.SourceContainer, + Name: "containerd", + Confidence: 0.8, + } } } return nil diff --git a/internal/source/source.go b/internal/source/source.go index b28722a..e496ee5 100644 --- a/internal/source/source.go +++ b/internal/source/source.go @@ -7,8 +7,10 @@ func DetectPrimary(chain []model.Process) string { switch p.Command { case "systemd": return "systemd" - case "dockerd", "containerd": + case "dockerd", "containerd", "kubelet": return "docker" + case "podman": + return "podman" case "pm2": return "pm2" case "cron": diff --git a/internal/source/supervisor.go b/internal/source/supervisor.go index d402864..9b3b29b 100644 --- a/internal/source/supervisor.go +++ b/internal/source/supervisor.go @@ -10,21 +10,33 @@ var knownSupervisors = map[string]string{ "pm2": "pm2", "pm2 god": "pm2", "supervisord": "supervisord", + "supervisor": "supervisord", "gunicorn": "gunicorn", "uwsgi": "uwsgi", "s6-supervise": "s6", "s6": "s6", + "s6-svscan": "s6", "runsv": "runit", "runit": "runit", + "runit-init": "runit", "openrc": "openrc", + "openrc-init": "openrc", "monit": "monit", "circusd": "circus", "circus": "circus", "systemd": "systemd service", + "systemctl": "systemd service", "daemontools": "daemontools", "init": "init", + "initctl": "upstart", "tini": "tini", "docker-init": "docker-init", + "podman-init": "podman-init", + "smf": "smf", + "launchd": "launchd", + "god": "god", + "forever": "forever", + "nssm": "nssm", } func detectSupervisor(ancestry []model.Process) *model.Source {