[PR #5956] Limit servers to IPv4 to make them work with WSL (only for WSL environments) #2637

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

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/5956
Author: @sh41
Created: 10/29/2025
Status: 🔄 Open

Base: masterHead: issue-1696


📝 Commits (2)

  • f71eae4 Limit servers to IPv4 to make them work with WSL
  • b18c7bc feat: make artifact and cache server network stack configurable

📊 Changes

7 files changed (+154 additions, -12 deletions)

View changed files

📝 cmd/input.go (+2 -0)
📝 cmd/root.go (+41 -2)
📝 cmd/root_test.go (+95 -0)
📝 pkg/artifactcache/handler.go (+3 -2)
📝 pkg/artifactcache/handler_test.go (+3 -3)
📝 pkg/artifacts/server.go (+9 -4)
📝 pkg/artifacts/server_test.go (+1 -1)

📄 Description

Summary

Builds on the work by @stickeegreg in #5912 and responds to the comment from @ChristopherHX to making the default network stack for the artifact and cache services tcp4 if running in WSL. Also added the option to configure via CLI flags.

Changes

  • Default behavior change:
    • WSL2: If environment variable WSL_DISTRO_NAME is set: Uses tcp4 (IPv4-only) when launching the artifact & cache services to avoid EHOSTUNREACH/ECONNREFUSED errors (see #2636 & #1866)
    • Other environments: Uses tcp (dual-stack IPv4/IPv6) as before.
  • Added --artifact-server-network and --cache-server-network CLI flags with validation for valid stack values (tcp, tcp4, tcp6)
  • Updated StartHandler() and Serve() to accept network parameter

Usage

# Use defaults (tcp4 on WSL2, tcp otherwise)
act

# On WSL2 override to use standard TCP
act --artifact-server-network tcp --cache-server-network tcp

# On non-WSL2 or if `WSL_DISTRO_NAME` isn't set for some reason: 
act --artifact-server-network tcp4 --cache-server-network tcp4

# Force IPv6 - I have no ability to test this as I don't have an ipv6 enabled machine to test on. 
act --artifact-server-network tcp6

Fixes #2636 - ECONNREFUSED to artifact service on WSL2
Fixes #1866 - Cache server EHOSTUNREACH on WSL2
Based on #5912 - Initial hardcoded fix


🔄 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/5956 **Author:** [@sh41](https://github.com/sh41) **Created:** 10/29/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `issue-1696` --- ### 📝 Commits (2) - [`f71eae4`](https://github.com/nektos/act/commit/f71eae4bca34f4f1c29008ab5594a32e80b4a444) Limit servers to IPv4 to make them work with WSL - [`b18c7bc`](https://github.com/nektos/act/commit/b18c7bc8120ddff2370c74cca93e7cb5202f0bf5) feat: make artifact and cache server network stack configurable ### 📊 Changes **7 files changed** (+154 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `cmd/input.go` (+2 -0) 📝 `cmd/root.go` (+41 -2) 📝 `cmd/root_test.go` (+95 -0) 📝 `pkg/artifactcache/handler.go` (+3 -2) 📝 `pkg/artifactcache/handler_test.go` (+3 -3) 📝 `pkg/artifacts/server.go` (+9 -4) 📝 `pkg/artifacts/server_test.go` (+1 -1) </details> ### 📄 Description ## Summary Builds on the work by @stickeegreg in #5912 and responds to the [comment from @ChristopherHX](https://github.com/nektos/act/pull/5912#issuecomment-3265291531) to making the default network stack for the artifact and cache services `tcp4` if running in WSL. Also added the option to configure via CLI flags. ## Changes - Default behavior change: - **WSL2**: If [environment variable `WSL_DISTRO_NAME`](https://github.com/microsoft/WSL/blob/fdfe1eb8439370c9eb6780467abc1e3f08f90eb1/src/linux/init/config.cpp#L845) is set: Uses `tcp4` (IPv4-only) when launching the artifact & cache services to avoid EHOSTUNREACH/ECONNREFUSED errors (see #2636 & #1866) - **Other environments**: Uses `tcp` (dual-stack IPv4/IPv6) as before. - Added `--artifact-server-network` and `--cache-server-network` CLI flags with validation for valid stack values (`tcp`, `tcp4`, `tcp6`) - Updated `StartHandler()` and `Serve()` to accept network parameter ## Usage ```bash # Use defaults (tcp4 on WSL2, tcp otherwise) act # On WSL2 override to use standard TCP act --artifact-server-network tcp --cache-server-network tcp # On non-WSL2 or if `WSL_DISTRO_NAME` isn't set for some reason: act --artifact-server-network tcp4 --cache-server-network tcp4 # Force IPv6 - I have no ability to test this as I don't have an ipv6 enabled machine to test on. act --artifact-server-network tcp6 ``` ## Related Issues Fixes #2636 - ECONNREFUSED to artifact service on WSL2 Fixes #1866 - Cache server EHOSTUNREACH on WSL2 Based on #5912 - Initial hardcoded fix --- <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#2637
No description provided.