mirror of
https://github.com/nektos/act.git
synced 2026-04-26 09:25:54 +03:00
[PR #5782] Fix segmentation fault in dry-run mode with service containers #2604
Labels
No labels
area/action
area/cli
area/docs
area/image
area/runner
area/workflow
backlog
confirmed/not-planned
kind/bug
kind/discussion
kind/external
kind/feature-request
kind/question
meta/duplicate
meta/invalid
meta/need-more-info
meta/resolved
meta/wontfix
meta/workaround
needs-work
pull-request
review/not-planned
size/M
size/XL
size/XXL
stale
stale-exempt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/act#2604
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/nektos/act/pull/5782
Author: @TheFynx
Created: 6/21/2025
Status: 🔄 Open
Base:
master← Head:2607-services-dry-run📝 Commits (4)
d1314b3fixed issue with service container dry-run usagec8becd3cleanup test3b4ce3aMerge branch 'master' into 2607-services-dry-rund704c91Merge branch 'nektos:master' into 2607-services-dry-run📊 Changes
3 files changed (+75 additions, -1 deletions)
View changed files
📝
pkg/container/docker_run.go(+19 -1)📝
pkg/runner/run_context.go(+8 -0)➕
pkg/runner/run_context_dryrun_test.go(+48 -0)📄 Description
Description
Fixes segmentation fault that occurs when running
act -n(dry-run mode) with GitHub Actions workflows containing service containers.Fixes #2607
Problem
When running workflows with service containers in dry-run mode, Act would crash with a segmentation fault at
pkg/container/docker_run.go:173in theGetHealth()method. This happened because:cr.cli.ContainerInspect(ctx, cr.id)cr.cliwas nilSolution
Added dry-run mode protection at two critical points:
GetHealth()method - ReturnsHealthHealthyimmediately in dry-run mode instead of attempting Docker inspectionwaitForServiceContainer()function - Skips all health checking in dry-run modeThe fix ensures that act's dry-run mode works consistently with service containers by providing appropriate mock responses instead of attempting real Docker operations.
Testing
TestServiceContainerWorkflowDryRunto prevent future regressionsact -nwith service containers no longer crashesTestRunEvent/servicesTestRunEvent/services-empty-imageTestRunEvent/services-host-networkTestRunEvent/services-with-containerTestRunEvent/mysql-service-container-with-health-checkCompliance
go fmt ./...go mod tidy(why go.mod was altered)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.