Act: Matrix variable used in job name not expanded

Created on 27 Feb 2020  路  9Comments  路  Source: nektos/act

Attempted to execute the workflow found here: https://github.com/davidalger/docker-images-php/blob/master/.github/workflows/build.yml

The result was the following (in many more colors than can be printed here):

[Docker Image CI/PHP ${{ matrix.php_version }}] 馃И  Matrix: map[php_version:73]
[Docker Image CI/PHP ${{ matrix.php_version }}] 馃И  Matrix: map[php_version:70]
[Docker Image CI/PHP ${{ matrix.php_version }}] 馃И  Matrix: map[php_version:55]
[Docker Image CI/PHP ${{ matrix.php_version }}] 馃殌  Start image=node:12.6-buster-slim
[Docker Image CI/PHP ${{ matrix.php_version }}] 馃И  Matrix: map[php_version:72]
[Docker Image CI/PHP ${{ matrix.php_version }}] 馃И  Matrix: map[php_version:71]
[Docker Image CI/PHP ${{ matrix.php_version }}] 馃殌  Start image=node:12.6-buster-slim
[Docker Image CI/PHP ${{ matrix.php_version }}] 馃И  Matrix: map[php_version:56]
[Docker Image CI/PHP ${{ matrix.php_version }}] 馃殌  Start image=node:12.6-buster-slim
[Docker Image CI/PHP ${{ matrix.php_version }}] 馃殌  Start image=node:12.6-buster-slim
[Docker Image CI/PHP ${{ matrix.php_version }}] 馃殌  Start image=node:12.6-buster-slim
[Docker Image CI/PHP ${{ matrix.php_version }}] 馃殌  Start image=node:12.6-buster-slim
[Docker Image CI/PHP ${{ matrix.php_version }}] Error: No such container: d4933363ec5c85a025ac8911508a6f4a1c95f5270cfd11c70207ac6966076470
[Docker Image CI/PHP ${{ matrix.php_version }}] Error: No such container: d4933363ec5c85a025ac8911508a6f4a1c95f5270cfd11c70207ac6966076470
[Docker Image CI/PHP ${{ matrix.php_version }}] Error: No such container: d4933363ec5c85a025ac8911508a6f4a1c95f5270cfd11c70207ac6966076470
[Docker Image CI/PHP ${{ matrix.php_version }}] Error: No such container: d4933363ec5c85a025ac8911508a6f4a1c95f5270cfd11c70207ac6966076470
[Docker Image CI/PHP ${{ matrix.php_version }}] Error: No such container: d4933363ec5c85a025ac8911508a6f4a1c95f5270cfd11c70207ac6966076470
Error: Error response from daemon: Conflict. The container name "/act-Docker-Image-CI-PHP-----ma" is already in use by container "30044369114ef881ddc84604bcc398f185170a9fad1ef8821971ef80f561e33d". You have to remove (or rename) that container to be able to reuse that name.

Since the container name is being derived from the job name, the job completely fails. The job name should render out (for example) to "[Docker Image CI/PHP 7.3]"

arerunner kinbug metworkaround

Most helpful comment

fix is available now in master, will be in next release

All 9 comments

fix is available now in master, will be in next release

Awesome. Thank you!

available in v0.2.5

@cplee I get the same issue with v0.2.5:

> act --version
act version 0.2.5

> act
[CI/build] 馃И  Matrix: map[node-version:13.x]
[CI/build] 馃И  Matrix: map[node-version:8.x]
[CI/build] 馃И  Matrix: map[node-version:12.x]
[CI/build] 馃И  Matrix: map[node-version:10.x]
[CI/build] 馃殌  Start image=node:12.6-buster-slim
[CI/build] 馃殌  Start image=node:12.6-buster-slim
[CI/build] 馃殌  Start image=node:12.6-buster-slim
[CI/build] 馃殌  Start image=node:12.6-buster-slim
Error: Error response from daemon: Conflict. The container name "/act-CI-build" is already in use by container "f9645ee53d6d668a2e5629de23e75059c8caedfa998c79f3e1ed84ab02daf34e". You have to remove (or rename) that container to be able to reuse that name.

Here is the Github action yaml.

If I try to give my builds a name like the OP did, it doesn't help:

name: CI

on: [push]

jobs:
  build:
    name: Node ${{ matrix.node-version }}
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [8.x, 10.x, 12.x, 13.x]

    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm install
    - run: npm test -- -v
    #- run: npm run report-coverage
      env:
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Result:

> act
ERRO[0000] Unable to interpolate string 'Node ${{ matrix.node-version }}' - [ReferenceError: 'version' is not defined] 
ERRO[0000] Unable to interpolate string 'Node ${{ matrix.node-version }}' - [ReferenceError: 'version' is not defined] 
ERRO[0000] Unable to interpolate string 'Node ${{ matrix.node-version }}' - [ReferenceError: 'version' is not defined] 
ERRO[0000] Unable to interpolate string 'Node ${{ matrix.node-version }}' - [ReferenceError: 'version' is not defined] 
[CI/Node ${{ matrix.node-version }}] 馃И  Matrix: map[node-version:13.x]
[CI/Node ${{ matrix.node-version }}] 馃И  Matrix: map[node-version:8.x]
[CI/Node ${{ matrix.node-version }}] 馃殌  Start image=node:12.6-buster-slim
[CI/Node ${{ matrix.node-version }}] 馃И  Matrix: map[node-version:10.x]
[CI/Node ${{ matrix.node-version }}] 馃殌  Start image=node:12.6-buster-slim
[CI/Node ${{ matrix.node-version }}] 馃殌  Start image=node:12.6-buster-slim
[CI/Node ${{ matrix.node-version }}] 馃И  Matrix: map[node-version:12.x]
[CI/Node ${{ matrix.node-version }}] 馃殌  Start image=node:12.6-buster-slim
Error: Error response from daemon: Conflict. The container name "/act-CI-Node-----matrix-node-ve" is already in use by container "52a10968257c61b39e658a5e50ff050e1e20536525ffb0ff35861893af80cc9f". You have to remove (or rename) that container to be able to reuse that name.

馃帀 It works if I use node_version instead of node-version, to bypass the ReferenceError:

name: CI

on: [push]

jobs:
  build:
    name: Node ${{ matrix.node_version }}
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node_version: [8.x, 10.x, 12.x, 13.x]

    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node_version }}
    - run: npm install
    - run: npm test -- -v
    #- run: npm run report-coverage
      env:
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Result:

> act
[CI/Node 13.x] 馃И  Matrix: map[node_version:13.x]
[CI/Node 10.x] 馃И  Matrix: map[node_version:10.x]
[CI/Node 8.x ] 馃И  Matrix: map[node_version:8.x]
[CI/Node 13.x] 馃殌  Start image=node:12.6-buster-slim
[CI/Node 12.x] 馃И  Matrix: map[node_version:12.x]
[CI/Node 10.x] 馃殌  Start image=node:12.6-buster-slim
[CI/Node 8.x ] 馃殌  Start image=node:12.6-buster-slim
[CI/Node 12.x] 馃殌  Start image=node:12.6-buster-slim
[CI/Node 10.x]   馃惓  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[CI/Node 12.x]   馃惓  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[CI/Node 8.x ]   馃惓  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[CI/Node 13.x]   馃惓  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
...

Nice troubleshooting @alexkli

OK to close again?

I think there are still two issues that could be fixed/improved:

  • support matrix build jobs that don't have a name (my original yaml, perfectly fine in github)
  • support - in variable names

Will leave open for first bullet point. Second one is covered by #104 which I closed as wontfix 馃槥

Was this page helpful?
0 / 5 - 0 ratings