Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix variable used in job name not expanded #108

Closed
davidalger opened this issue Feb 27, 2020 · 9 comments
Closed

Matrix variable used in job name not expanded #108

davidalger opened this issue Feb 27, 2020 · 9 comments
Labels
area/runner Relating to errors in the runner kind/bug Something isn't working meta/workaround A workaround has been identified.

Comments

@davidalger
Copy link

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]"

@cplee
Copy link
Contributor

cplee commented Feb 27, 2020

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

@davidalger
Copy link
Author

Awesome. Thank you!

@cplee
Copy link
Contributor

cplee commented Feb 28, 2020

available in v0.2.5

@alexkli
Copy link

alexkli commented Mar 4, 2020

@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.

@cplee cplee reopened this Mar 4, 2020
@alexkli
Copy link

alexkli commented Mar 4, 2020

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.

@alexkli
Copy link

alexkli commented Mar 4, 2020

🎉 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=[]
...

@cplee
Copy link
Contributor

cplee commented Mar 4, 2020

Nice troubleshooting @alexkli

OK to close again?

@alexkli
Copy link

alexkli commented Mar 4, 2020

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

@cplee
Copy link
Contributor

cplee commented Mar 4, 2020

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

@cplee cplee added area/runner Relating to errors in the runner kind/bug Something isn't working meta/workaround A workaround has been identified. labels Mar 4, 2020
@cplee cplee closed this as completed in 59b9b8e Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/runner Relating to errors in the runner kind/bug Something isn't working meta/workaround A workaround has been identified.
Projects
None yet
Development

No branches or pull requests

3 participants