[PR #6008] fix: guard GetHealth against nil docker client in dry-run mode #2661

Open
opened 2026-03-01 22:37:37 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/6008
Author: @veeceey
Created: 2/23/2026
Status: 🔄 Open

Base: masterHead: fix/issue-5934-dryrun-nil-gethealth


📝 Commits (1)

  • 68ed563 fix: guard GetHealth against nil docker client in dry-run mode

📊 Changes

1 file changed (+4 additions, -0 deletions)

View changed files

📝 pkg/container/docker_run.go (+4 -0)

📄 Description

When running act -n (dry-run mode) with workflows that define service containers, the process panics with a SIGSEGV because GetHealth() tries to call ContainerInspect on a nil docker client.

In dry-run mode, connect() is skipped via .IfNot(common.Dryrun), so cr.cli is never set. But waitForServiceContainer still calls GetHealth() unconditionally, which dereferences the nil client.

The fix adds a nil check on cr.cli at the top of GetHealth() — if there's no client, we just return HealthHealthy and move on. This matches the pattern already used by Start() and Remove() which skip execution during dry-run.

Tested by verifying the build compiles cleanly. The existing container tests require a live Docker daemon so they can't run in CI-less environments, but the logic is straightforward — just a nil guard.

Fixes #5934


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/6008 **Author:** [@veeceey](https://github.com/veeceey) **Created:** 2/23/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fix/issue-5934-dryrun-nil-gethealth` --- ### 📝 Commits (1) - [`68ed563`](https://github.com/nektos/act/commit/68ed563b697c656985a71f9f10e4bc96f6005f44) fix: guard GetHealth against nil docker client in dry-run mode ### 📊 Changes **1 file changed** (+4 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `pkg/container/docker_run.go` (+4 -0) </details> ### 📄 Description When running `act -n` (dry-run mode) with workflows that define service containers, the process panics with a SIGSEGV because `GetHealth()` tries to call `ContainerInspect` on a nil docker client. In dry-run mode, `connect()` is skipped via `.IfNot(common.Dryrun)`, so `cr.cli` is never set. But `waitForServiceContainer` still calls `GetHealth()` unconditionally, which dereferences the nil client. The fix adds a nil check on `cr.cli` at the top of `GetHealth()` — if there's no client, we just return `HealthHealthy` and move on. This matches the pattern already used by `Start()` and `Remove()` which skip execution during dry-run. Tested by verifying the build compiles cleanly. The existing container tests require a live Docker daemon so they can't run in CI-less environments, but the logic is straightforward — just a nil guard. Fixes #5934 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#2661
No description provided.