Skip to content

act does not create separate containers for matrix builds with reusable workflows #2003

@Andy4495

Description

@Andy4495

Bug report info

act version:            0.2.50
GOOS:                   darwin
GOARCH:                 amd64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
	$HOME/.docker/run/docker.sock
Config files:           
	/Users/andy/.actrc:
		-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest
		-P ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04
		-P ubuntu-18.04=ghcr.io/catthehacker/ubuntu:act-18.04
Build info:
	Go version:            go1.21.0
	Module path:           command-line-arguments
	Main version:          
	Main path:             
	Main checksum:         
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -X main.version=0.2.50
		DefaultGODEBUG:       panicnil=1
		CGO_ENABLED:          1
		CGO_CFLAGS:           
		CGO_CPPFLAGS:         
		CGO_CXXFLAGS:         
		CGO_LDFLAGS:          
		GOARCH:               amd64
		GOOS:                 darwin
		GOAMD64:              v1
Docker Engine:
	Engine version:        24.0.5
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         cgroupfs
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Docker Desktop
	OS type:               linux
	OS version:            
	OS arch:               x86_64
	OS kernel:             5.15.49-linuxkit-pr
	OS CPU:                4
	OS memory:             7859 MB
	Security options:
		name=seccomp,profile=unconfined
		name=cgroupns

Command used with act

act -j call-reusable-workflow

Describe issue

When using act with reusable workflows called with a matrix strategy, act does not create separate docker containers for each matrix combination; it tries to run them all in the same container which generates an error (see log output below).

If I run the same matrix strategy in a standalone workflow, act creates a separate docker container for each matrix combination and the workflow runs successfully.

Link to GitHub repository

https://github.com/Andy4495/act-workflow-test

Workflow content

# The "caller" workflow
name: Call Reusable Workflow

on: 
  push:
  workflow_dispatch:

jobs:
  call-reusable-workflow: 
    strategy:
      matrix:
        include:
          - message: test1
          - message: test2
          - message: test3
          - message: test4
 
    name: call-reusable-workflow
    uses: Andy4495/act-workflow-test/.github/workflows/reusable-flow.yml@main
    with:
      message: ${{ matrix.message }}

---

# The "called" (reusable) workflow
name: reusable-workflow

on: 
  workflow_call:
    inputs:
      message:
        description: Message to display
        required: true
        type: string

jobs:
  reusable-workflow: 
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Print the message
        run: |
          echo Test reusable workflow ${{ inputs.message }}

Relevant log output

Error: failed to create container: 'Error response from daemon: Conflict. The container name "/act-call-reusable-workflow-reusable-workflow-reusable-workflow-c7535ef5a84abfd1f2412cceca72bd226072ccb44b16a59787972320d9cb1a2d" is already in use by container "d0baad951ea56daf6bd3097af098d08b22d726733e0e4a54120fe40c357874a0". You have to remove (or rename) that container to be able to reuse that name.'

Additional information

As mentioned above, this works fine with standalone workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions