nektos / act

Run your GitHub Actions locally πŸš€
https://nektosact.com
MIT License
52.18k stars 1.31k forks source link

Cache server EHOSTUNREACH #1866

Open yknx4 opened 1 year ago

yknx4 commented 1 year ago

Bug report info

act version:            0.2.46
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
Config files:
        /home/yknx4/.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.20.4
        Module path:           command-line-arguments
        Main version:
        Main path:
        Main checksum:
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -X main.version=0.2.46
                CGO_ENABLED:          1
                CGO_CFLAGS:
                CGO_CPPFLAGS:
                CGO_CXXFLAGS:
                CGO_LDFLAGS:
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
Docker Engine:
        Engine version:        24.0.2
        Engine runtime:        runc
        Cgroup version:        1
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:
        OS arch:               x86_64
        OS kernel:             5.15.90.1-microsoft-standard-WSL2
        OS CPU:                16
        OS memory:             15614 MB
        Security options:
                name=seccomp,profile=builtin

Command used with act

act -s GITHUB_TOKEN="$(gh auth token)"

Describe issue

Cache is not working on WSL2, it cannot reach the server and thus all cache actions always fail.

Link to GitHub repository

No response

Workflow content

name: deps
on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
jobs:
  deps:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: apt update
        run: sudo apt-get update
        shell: bash
      - uses: awalsh128/cache-apt-pkgs-action@latest
        with:
          packages: libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libdrm2 libexpat1 libgbm1 libglib2.0-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libuuid1 libx11-6 libx11-xcb1 libxcb-dri3-0 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxkbcommon0 libxrandr2 libxrender1 libxshmfence1 libxss1 libxtst6
          version: 1.0

Relevant log output

[tests/deps] [DEBUG] type=remote-action actionDir=/home/yknx4/.cache/act/actions-cache-restore@v3 actionPath=restore workdir=/home/yknx4/src/zoobean/beanstack2 actionCacheDir=/home/yknx4/.cache/act actionName=actions-cache-restore@v3/restore containerActionDir=/var/run/act/actions/actions-cache-restore@v3/restore
[tests/deps] [DEBUG] Removing /home/yknx4/.cache/act/actions-cache-restore@v3/.gitignore before docker cp
[tests/deps] [DEBUG] /var/run/act/actions/actions-cache-restore@v3/
[tests/deps]   🐳  docker cp src=/home/yknx4/.cache/act/actions-cache-restore@v3/ dst=/var/run/act/actions/actions-cache-restore@v3/
[tests/deps] [DEBUG] Writing tarball /tmp/act2930208774 from /home/yknx4/.cache/act/actions-cache-restore@v3/
[tests/deps] [DEBUG] Stripping prefix:/home/yknx4/.cache/act/actions-cache-restore@v3/ src:/home/yknx4/.cache/act/actions-cache-restore@v3/
[tests/deps] [DEBUG] Extracting content from '/tmp/act2930208774' to '/var/run/act/actions/actions-cache-restore@v3/'
[tests/deps] [DEBUG] executing remote job container: [node /var/run/act/actions/actions-cache-restore@v3/dist/restore-only/index.js]
[tests/deps]   🐳  docker exec cmd=[node /var/run/act/actions/actions-cache-restore@v3/dist/restore-only/index.js] user= workdir=
[tests/deps] [DEBUG] Exec command '[node /var/run/act/actions/actions-cache-restore@v3/dist/restore-only/index.js]'
[tests/deps] [DEBUG] Working directory '/home/yknx4/src/zoobean/beanstack2'
[tests/deps]   πŸ’¬  ::debug::Resolved Keys:
[tests/deps]   πŸ’¬  ::debug::["cache-apt-pkgs_91edd1e3afe94ade0b2f1b8baaebca72"]
[tests/deps]   πŸ’¬  ::debug::Checking zstd --quiet --version
[tests/deps]   πŸ’¬  ::debug::1.4.8
[tests/deps]   πŸ’¬  ::debug::zstd version: 1.4.8
[tests/deps]   πŸ’¬  ::debug::Resource Url: http://172.17.143.138:42599/_apis/artifactcache/cache?keys=cache-apt-pkgs_91edd1e3afe94ade0b2f1b8baaebca72&version=9b20c9814e5d39ed5fb2bca3e82b64cef01cbcd6d355d0711cce04946822a7bd
[tests/deps]   πŸ’¬  ::debug::getCacheEntry - Attempt 1 of 2 failed with error: connect EHOSTUNREACH 172.17.143.138:42599
[tests/deps]   πŸ’¬  ::debug::Resource Url: http://172.17.143.138:42599/_apis/artifactcache/cache?keys=cache-apt-pkgs_91edd1e3afe94ade0b2f1b8baaebca72&version=9b20c9814e5d39ed5fb2bca3e82b64cef01cbcd6d355d0711cce04946822a7bd
[tests/deps]   πŸ’¬  ::debug::getCacheEntry - Attempt 2 of 2 failed with error: connect EHOSTUNREACH 172.17.143.138:42599
[tests/deps]   🚧  ::warning::Failed to restore: getCacheEntry failed: connect EHOSTUNREACH 172.17.143.138:42599
[tests/deps]   πŸ’¬  ::debug::Failed to delete archive: Error: ENOENT: no such file or directory, unlink ''
| Cache not found for input keys: cache-apt-pkgs_91edd1e3afe94ade0b2f1b8baaebca72
[tests/deps]   βœ…  Success - Main actions/cache/restore@v3
[tests/deps]   βš™  ::set-output:: cache-primary-key=cache-apt-pkgs_91edd1e3afe94ade0b2f1b8baaebca72

Additional information

This is running in Windows with WSL2

wolfogre commented 1 year ago

In some environments, act cannot detect the correct IP to bind for the cache server (and artifact server).

"The correct IP" means it's accessible from Docker containers. I'm not familiar with WSL2, but I think you could try other IPs of your sub Linux system and specify it manually via act --cache-server-addr <IP>.

yknx4 commented 1 year ago

@wolfogre Hey, I looked at it and it seems it is a little more complicated than that. It seems a docker container can't communicate with a WSL instance (The windows VM) it can only do it to the Windows host. so it can never reach the act process running locally. I'm looking for ways to fix this, either on the wsl side or maybe on the docker side. I'll let you know if I found something relevant to the project and probably add a PR to the Readme to make it run on WSL2 properly

ChristopherHX commented 1 year ago

I had this problem over a year ago, (not with act, but similar kind of network issue)

I think in my case was docker.host.internal also broken at the same time.

Somewhat offtopic, windows container would need a windows firewall rule due to network adapter setup

The wsl problem seem to be different...

host.docker.internal has a different ip inside wsl2

mikicho commented 10 months ago

@yknx4 I have the same problem. Did you find something?

StefanLobbenmeierObjego commented 9 months ago

I also ran into this issue on macOS, but was able to solve this using

--cache-server-addr host.docker.internal

Might make sense to have that be the default on macOS?

github-actions[bot] commented 3 months ago

Issue is stale and will be closed in 14 days unless there is new activity

mikicho commented 3 months ago

don't

mikicho commented 3 months ago

My solution was to stop using the docker desktop. I didn't use the GUI anyway..