catthehacker / docker_images

Docker images
MIT License
212 stars 75 forks source link

Occasional failures when using actions/setup-node@v4 #126

Open abevoelker opened 4 months ago

abevoelker commented 4 months ago

I'm not quite sure if this is an issue with the Docker image or with nektos/act (possibly its caching behavior?) but not infrequently when I run a workflow locally using the ghcr.io/catthehacker/ubuntu:act-latest image that uses actions/setup-node@v4 I get non-deterministic errors like this:

[test/test-10]   🐳  docker exec cmd=[node /var/run/act/actions/actions-setup-node@v4/dist/setup/index.js] user= workdir=
[test/test-10]   | node:internal/modules/cjs/loader:1143
[test/test-10]   |   throw err;
[test/test-10]   |   ^
[test/test-10]   | 
[test/test-10]   | Error: Cannot find module '/var/run/act/actions/actions-setup-node@v4/dist/setup/index.js'
[test/test-10]   |     at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
[test/test-10]   |     at Module._load (node:internal/modules/cjs/loader:981:27)
[test/test-10]   |     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
[test/test-10]   |     at node:internal/main/run_main_module:28:49 {
[test/test-10]   |   code: 'MODULE_NOT_FOUND',
[test/test-10]   |   requireStack: []
[test/test-10]   | }
[test/test-10]   | 
[test/test-10]   | Node.js v18.20.2
[test/test-10]   ❌  Failure - Main actions/setup-node@v4
[test/test-10] exitcode '1': failure
[test/test-10] 🏁  Job failed

Sometimes it happens during the main action and fails the job as above; other times it happens during the post-action and doesn't affect the job status:

[test/test-13]   βœ…  Success - Main sleep 10
[test/test-13] ⭐ Run Post actions/setup-node@v4
[test/test-13]   🐳  docker exec cmd=[node /var/run/act/actions/actions-setup-node@v4/dist/cache-save/index.js] user= workdir=
[test/test-13]   | node:internal/modules/cjs/loader:1143
[test/test-13]   |   throw err;
[test/test-13]   |   ^
[test/test-13]   | 
[test/test-13]   | Error: Cannot find module '/var/run/act/actions/actions-setup-node@v4/dist/cache-save/index.js'
[test/test-13]   |     at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
[test/test-13]   |     at Module._load (node:internal/modules/cjs/loader:981:27)
[test/test-13]   |     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
[test/test-13]   |     at node:internal/main/run_main_module:28:49 {
[test/test-13]   |   code: 'MODULE_NOT_FOUND',
[test/test-13]   |   requireStack: []
[test/test-13]   | }
[test/test-13]   | 
[test/test-13]   | Node.js v18.20.2
[test/test-13]   ❌  Failure - Post actions/setup-node@v4
[test/test-13] Cleaning up container for job test
[test/test-13] 🏁  Job succeeded

Here's a sample .yaml I'm currently (sometimes) reproducing this issue on:

name: test

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: true
      matrix:
        ruby-version:
          - 3.2
          - 3.1
          - "3.0"
          - 2.7
          - 2.6
          - 2.5
        rails-version:
          # - "edge"
          - 7
          - 6.1
          - "6.0"
        exclude:
          # Rails 7 requires Ruby 2.7+
          - ruby-version: 2.5
            rails-version: 7
          - ruby-version: 2.6
            rails-version: 7
          # Rails 6 requires Ruby <= 3.0
          - ruby-version: 3.1
            rails-version: "6.0"
          - ruby-version: 3.2
            rails-version: "6.0"
    steps:
      - uses: actions/checkout@v4
      - name: Set up Ruby ${{ matrix.ruby-version }}
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby-version }}
          rubygems: latest
      - uses: actions/setup-node@v4
        with:
          node-version: 18
      - run: sleep 10
      #- run: sleep $[ ( $RANDOM % 10 )  + 5 ]s

Running it with:

$ act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest -W ./test.yml

I will try to pare the YAML down to minimally reproducible as time allows

Debug info

$ act --version
act version 0.2.61
$ docker images --filter reference=catthehacker/ubuntu:act-latest
REPOSITORY            TAG          IMAGE ID       CREATED      SIZE
catthehacker/ubuntu   act-latest   fccf5eddb7c6   6 days ago   1.27GB