nektos / act

Run your GitHub Actions locally 🚀
https://nektosact.com
MIT License
54.36k stars 1.36k forks source link

xu-cheng/latex-action@v3 calls docker and volumes aren't properly mapped #2382

Open virzak opened 3 months ago

virzak commented 3 months ago

Bug report info

act version:            0.2.64
GOOS:                   windows
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        \\.\pipe\docker_engine(broken)
Config files:
        C:\Users\virzak\AppData\Local\act\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
                -P windows-latest=-self-hosted
                --artifact-server-path C:/TMP/artifacts
                --use-new-action-cache
                --env ACTIONS_CACHE_URL=http://127.0.0.1:8080/
                --env ACTIONS_RUNTIME_URL=http://127.0.0.1:8080/
                --env ACTIONS_RUNTIME_TOKEN=token
                --env ACT_CACHE_AUTH_KEY=token
Build info:
        Go version:            go1.21.11
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -s -w -X main.version=0.2.64 -X main.commit=aa54ea933591a57d1179c2691a57f2017aa855e5 -X main.date=2024-07-01T02:21:46Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 windows
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         aa54ea933591a57d1179c2691a57f2017aa855e5
                vcs.time:             2024-07-01T02:21:27Z
                vcs.modified:         false
Docker Engine:
        Engine version:        5.1.1
        Engine runtime:        crun
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlay
        Registry URI:
        OS:                    fedora
        OS type:               linux
        OS version:            40
        OS arch:               amd64
        OS kernel:             5.15.153.1-microsoft-standard-WSL2
        OS CPU:                16
        OS memory:             30982 MB
        Security options:
                name=seccomp,profile=default
                name=rootless

Command used with act

act

Describe issue

An action calls docker inside its script. That results in a situation where there is a host, act container and action container. https://github.com/xu-cheng/latex-action/blob/1ccd8e9a1ba76e30b547a1baf0e9c6d5ca33aea3/action.sh#L56

It also maps volumes from the act container to the action container, which is apparently impossible.

Is there a common solution to these types of actions?

Link to GitHub repository

https://github.com/george-lim/resume

Workflow content

name: CI

on:
  push:
    branches: main
  pull_request:
    branches: main
  workflow_dispatch:

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: xu-cheng/latex-action@v3
        with:
          root_file: resume.tex
      - uses: actions/upload-artifact@v4
        with:
          name: Resume
          path: resume.pdf

Relevant log output

https://pastebin.com/Cq0p2ptu

Additional information

No response

ChristopherHX commented 3 months ago

Technically for act you could try

At some point I would ask you, is act the right tool for your usecase? Do you know that actions/runner can be executed like act locally? I have written such a tool (just because I'm able to do it), because act didn't fit my needs for an exact GitHub Actions Clone A windows host can complicate things if you want to emulate a true linux system, applies for all scenarios wether you use act or not.

virzak commented 3 months ago

Thanks for your response.

At some point I would ask you, is act the right tool for your usecase?

I was wondering how a case of docker being called from inside the action could be handled. The question was more of a theoretical one; I don't have any urgent need for this. I can also drop to xu-cheng/latex-action@v2 which does work with act.

And it does work on my ubuntu machine with -P ubuntu-latest=-self-hosted

One Idea that I had was to let act know variables like GITHUB_STEP_SUMMARY should point to the host /mnt/something.... That way when an action script calls docker, these variables would be passed down like GITHUB_WORKSPACE gets passed down. https://github.com/xu-cheng/latex-action/blob/1ccd8e9a1ba76e30b547a1baf0e9c6d5ca33aea3/action.sh#L127-L132