nektos / act

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

upload-artifact@v4 fails in Codespace with ERRO[0009] #2481

Open gblikas opened 3 days ago

gblikas commented 3 days ago

Bug report info

act version:            0.2.68
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
Config files:           
        /home/codespace/.config/act/actrc:
                -P ubuntu-latest=catthehacker/ubuntu:full-latest
                -P ubuntu-22.04=catthehacker/ubuntu:full-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:full-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:full-18.04
Build info:
        Go version:            go1.21.13
        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.68 -X main.commit=03a4480cd024910c88c8946da8d589b9ef0c6660 -X main.date=2024-10-01T02:31:47Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         03a4480cd024910c88c8946da8d589b9ef0c6660
                vcs.time:             2024-10-01T02:31:30Z
                vcs.modified:         false
Docker Engine:
        Engine version:        27.0.3-1
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Ubuntu 20.04.6 LTS (containerized)
        OS type:               linux
        OS version:            20.04
        OS arch:               x86_64
        OS kernel:             6.5.0-1025-azure
        OS CPU:                16
        OS memory:             64290 MB
        Security options:
                name=apparmor
                name=seccomp,profile=builtin
                name=cgroupns

Command used with act

act -s GITHUB_TOKEN="$(gh auth token)" -W "./.github/workflows/main.yml" --artifact-server-path ./artifacts

Describe issue

When using https://github.com/actions/upload-artifact's v4 step, within my Github Codespace,

      - name: Upload build output
        # if: steps.cache_build.outputs.cache-hit != 'true'
        uses: actions/upload-artifact@v4
        with:
          name: build-output-${{ inputs.build_type }}
          path: ${{ inputs.sub_folder }}/builds

I get the following error:

[build_project/build_jobs]   💬  ::debug::Uploading artifact zip to blob storage with maxConcurrency: 256, bufferSize: 8388608
| Beginning upload of artifact content to blob storage
ERRO[0009] Error unauthorized       

I haven't tried it with v3, as that will be quickly depricated, and I've verified that gh auth token is the same as $GITHUB_CODESPACE_TOKEN. -v provides no better output. What's more interesting is the fact that the artifact uploads, however, the step doesn't complete successfully - that is, ./artifacts contains the target output, but the step still fails.

I have verified that the same code runs fine when locally run on my machine using the same act command (below).

Link to GitHub repository

No response

Workflow content

I can share privately in dm.

Relevant log output

[build_project/build_jobs]   💬  ::debug::Uploading artifact zip to blob storage with maxConcurrency: 256, bufferSize: 8388608
| Beginning upload of artifact content to blob storage
ERRO[0010] Error unauthorized                           
[build_project/build_jobs]   ❗  ::error::
[build_project/build_jobs]   ❌  Failure - Main Upload build output

Additional information

Perhaps this has to do with firewall issues, https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#communication-between-self-hosted-runners-and-github, however that doesn't appear to be the case because the actual upload looks like it works fine.

gblikas commented 2 days ago

edit the artifact that is uploaded is broken, i.e. doesn't unzip due to some file formatting error or corruption.