[GH-ISSUE #2617] matrix cli parameter can't parse matrix values that have colons within #1188

Closed
opened 2026-03-01 21:49:32 +03:00 by kerem · 4 comments
Owner

Originally created by @Fryguy on GitHub (Jan 14, 2025).
Original GitHub issue: https://github.com/nektos/act/issues/2617

Bug report info

act version:            0.2.71
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 10
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
Config files:
	/Users/jfrey/.actrc:
		-P ubuntu-latest=catthehacker/ubuntu:act-latest
		-P ubuntu-22.04=catthehacker/ubuntu:act-22.04
		-P ubuntu-20.04=catthehacker/ubuntu:act-20.04
		-P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
	Go version:            go1.23.4
	Module path:           command-line-arguments
	Main version:
	Main path:
	Main checksum:
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -X main.version=0.2.71
		CGO_ENABLED:          1
		CGO_CFLAGS:
		CGO_CPPFLAGS:
		CGO_CXXFLAGS:
		CGO_LDFLAGS:
		GOARCH:               arm64
		GOOS:                 darwin
		GOARM64:              v8.0
Docker Engine:
	Engine version:        5.2.1
	Engine runtime:        crun
	Cgroup version:        2
	Cgroup driver:         systemd
	Storage driver:        overlay
	Registry URI:
	OS:                    fedora
	OS type:               linux
	OS version:            40
	OS arch:               arm64
	OS kernel:             6.9.11-200.fc40.aarch64
	OS CPU:                8
	OS memory:             11094 MB
	Security options:
		name=seccomp,profile=default
		name=selinux

Command used with act

act --job ci --matrix 3.1:18:spec\:jest --container-architecture linux/amd64

Describe issue

Our matrix is defined a below. However, because : is the separator character on the command line for the --matrix and some of our matrix entries also use :, I can't specify the test-suite component. I was expecting a way to escape the : or have a different separator character, but I can't seem to find one.

I tried running with both --matrix 3.1:18:spec\:jest and --matrix 3.1:18:spec:jest, but neither work. I expect it to run the test suite specified, and then if it can't find it I expect it to fail saying it can't find that matrix entry. Instead, interestingly, act seems to run a random test suite, but sets up a service for every matrix entry anyway. So I have 14 services, but only one test-suite running which isn't the one I requested. Running multiple times seems to choose different test suites. Perhaps, it is running all of the suites, but since the services all bind to the same port only the first one "wins" - I do see an error at the very end that it can't bind to the service port.

https://github.com/ManageIQ/manageiq-ui-classic

Workflow content

---
name: CI
on:
  push:
  pull_request:
  workflow_dispatch:
  schedule:
  - cron: 0 0 * * *
jobs:
  ci:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby-version:
        - '3.1'
        - '3.3'
        node-version:
        - 18
        test-suite:
        - spec
        - spec:compile
        - spec:debride
        - spec:javascript
        - spec:jest
        - spec:routes
        - spec:security
    services:
      postgres:
        image: manageiq/postgresql:13
        env:
          POSTGRESQL_USER: root
          POSTGRESQL_PASSWORD: smartvm
          POSTGRESQL_DATABASE: vmdb_test
        options: "--health-cmd pg_isready --health-interval 2s --health-timeout 5s
          --health-retries 5"
        ports:
        - 5432:5432
    env:
      TEST_SUITE: "${{ matrix.test-suite }}"
      PGHOST: localhost
      PGPASSWORD: smartvm
      CC_TEST_REPORTER_ID: "${{ secrets.CC_TEST_REPORTER_ID }}"
    steps:
    - uses: actions/checkout@v4
    - name: Set up system
      run: bin/before_install
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: "${{ matrix.ruby-version }}"
        bundler-cache: true
      timeout-minutes: 30
    - name: Set up Node
      if: "${{ matrix.test-suite == 'spec:compile' || matrix.test-suite == 'spec:javascript'
        || matrix.test-suite == 'spec:jest' }}"
      uses: actions/setup-node@v4
      with:
        node-version: "${{ matrix.node-version }}"
        cache: yarn
        registry-url: https://npm.manageiq.org/
    - name: Prepare tests
      run: bin/setup
    - name: Run tests
      run: bundle exec rake
    - name: Report code coverage
      if: ${{ github.ref == 'refs/heads/master' && matrix.ruby-version == '3.3' && matrix.test-suite == 'spec' }}
      continue-on-error: true
      uses: paambaati/codeclimate-action@v5

Relevant log output

Expecting spec:jest to run but instead it chooses a random one to run:

[CI/ci-4 ] 🧪  Matrix: map[node-version:18 ruby-version:3.1 test-suite:spec:javascript]
[CI/ci-4 ] ⭐ Run Main actions/checkout@v4

Additional information

No response

Originally created by @Fryguy on GitHub (Jan 14, 2025). Original GitHub issue: https://github.com/nektos/act/issues/2617 ### Bug report info ```plain text act version: 0.2.71 GOOS: darwin GOARCH: arm64 NumCPU: 10 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock Config files: /Users/jfrey/.actrc: -P ubuntu-latest=catthehacker/ubuntu:act-latest -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 -P ubuntu-20.04=catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=catthehacker/ubuntu:act-18.04 Build info: Go version: go1.23.4 Module path: command-line-arguments Main version: Main path: Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -X main.version=0.2.71 CGO_ENABLED: 1 CGO_CFLAGS: CGO_CPPFLAGS: CGO_CXXFLAGS: CGO_LDFLAGS: GOARCH: arm64 GOOS: darwin GOARM64: v8.0 Docker Engine: Engine version: 5.2.1 Engine runtime: crun Cgroup version: 2 Cgroup driver: systemd Storage driver: overlay Registry URI: OS: fedora OS type: linux OS version: 40 OS arch: arm64 OS kernel: 6.9.11-200.fc40.aarch64 OS CPU: 8 OS memory: 11094 MB Security options: name=seccomp,profile=default name=selinux ``` ### Command used with act ```sh act --job ci --matrix 3.1:18:spec\:jest --container-architecture linux/amd64 ``` ### Describe issue Our matrix is defined a below. However, because `:` is the separator character on the command line for the `--matrix` and some of our matrix entries _also_ use `:`, I can't specify the test-suite component. I was expecting a way to escape the `:` or have a different separator character, but I can't seem to find one. I tried running with both `--matrix 3.1:18:spec\:jest` and `--matrix 3.1:18:spec:jest`, but neither work. I expect it to run the test suite specified, and then if it can't find it I expect it to fail saying it can't find that matrix entry. Instead, interestingly, act seems to run a random test suite, but sets up a service for every matrix entry anyway. So I have 14 services, but only one test-suite running which isn't the one I requested. Running multiple times seems to choose different test suites. Perhaps, it is running all of the suites, but since the services all bind to the same port only the first one "wins" - I do see an error at the very end that it can't bind to the service port. ### Link to GitHub repository https://github.com/ManageIQ/manageiq-ui-classic ### Workflow content ```yml --- name: CI on: push: pull_request: workflow_dispatch: schedule: - cron: 0 0 * * * jobs: ci: runs-on: ubuntu-latest strategy: matrix: ruby-version: - '3.1' - '3.3' node-version: - 18 test-suite: - spec - spec:compile - spec:debride - spec:javascript - spec:jest - spec:routes - spec:security services: postgres: image: manageiq/postgresql:13 env: POSTGRESQL_USER: root POSTGRESQL_PASSWORD: smartvm POSTGRESQL_DATABASE: vmdb_test options: "--health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 5" ports: - 5432:5432 env: TEST_SUITE: "${{ matrix.test-suite }}" PGHOST: localhost PGPASSWORD: smartvm CC_TEST_REPORTER_ID: "${{ secrets.CC_TEST_REPORTER_ID }}" steps: - uses: actions/checkout@v4 - name: Set up system run: bin/before_install - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: "${{ matrix.ruby-version }}" bundler-cache: true timeout-minutes: 30 - name: Set up Node if: "${{ matrix.test-suite == 'spec:compile' || matrix.test-suite == 'spec:javascript' || matrix.test-suite == 'spec:jest' }}" uses: actions/setup-node@v4 with: node-version: "${{ matrix.node-version }}" cache: yarn registry-url: https://npm.manageiq.org/ - name: Prepare tests run: bin/setup - name: Run tests run: bundle exec rake - name: Report code coverage if: ${{ github.ref == 'refs/heads/master' && matrix.ruby-version == '3.3' && matrix.test-suite == 'spec' }} continue-on-error: true uses: paambaati/codeclimate-action@v5 ``` ### Relevant log output ```sh Expecting spec:jest to run but instead it chooses a random one to run: [CI/ci-4 ] 🧪 Matrix: map[node-version:18 ruby-version:3.1 test-suite:spec:javascript] [CI/ci-4 ] ⭐ Run Main actions/checkout@v4 ``` ### Additional information _No response_
kerem 2026-03-01 21:49:32 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@Andy4495 commented on GitHub (Jan 14, 2025):

I don't think you are specifying the matrix correctly on the command line. I didn't test your workflow, but I checked one of mine with a colon and it worked.

I think the matrix option you want to run is this:

--matrix ruby-version:'3.1' test-suite:spec:jest

(I don't think you need to specify node-version, since there is only one choice in your matrix.)

Also, you can run it with the verbose option --verbose to see how act is evaluating the matrix parameters.

<!-- gh-comment-id:2591121957 --> @Andy4495 commented on GitHub (Jan 14, 2025): I don't think you are specifying the matrix correctly on the command line. I didn't test your workflow, but I checked one of mine with a colon and it worked. I think the matrix option you want to run is this: ```shell --matrix ruby-version:'3.1' test-suite:spec:jest ``` (I don't think you need to specify `node-version`, since there is only one choice in your matrix.) Also, you can run it with the verbose option `--verbose` to see how act is evaluating the matrix parameters.
Author
Owner

@Fryguy commented on GitHub (Jan 14, 2025):

Ah now I understand - I misunderstood how the matrix parameter works and didn't realize you pass key/value pairs. That being said, the version you specified didn't work and I can't figure out the combo. I can't pass it with spaces between the values, because then it interprets the second value as a filter and I get

DEBU[0000] Evaluated matrix inclusions: map[ruby-version:map[3.1:true]]
...
DEBU[0000] Using first passed in arguments event for filtering: test-suite:spec:jest
DEBU[0000] Preparing plan with a job: ci
DEBU[0000] Using first passed in arguments event: test-suite:spec:jest

with quotes it seems to parse it incorrectly:

--matrix "ruby-version:3.1 node-version:18 test-suite:spec:jest"

DEBU[0000] Job Matrices: [map[node-version:18 ruby-version:3.1 test-suite:spec] map[node-version:18 ruby-version:3.3 test-suite:spec] map[node-version:18 ruby-version:3.1 test-suite:spec:compile] map[node-version:18 ruby-version:3.3 test-suite:spec:compile] map[node-version:18 ruby-version:3.1 test-suite:spec:debride] map[node-version:18 ruby-version:3.3 test-suite:spec:debride] map[node-version:18 ruby-version:3.1 test-suite:spec:javascript] map[node-version:18 ruby-version:3.3 test-suite:spec:javascript] map[node-version:18 ruby-version:3.1 test-suite:spec:jest] map[node-version:18 ruby-version:3.3 test-suite:spec:jest] map[node-version:18 ruby-version:3.1 test-suite:spec:routes] map[node-version:18 ruby-version:3.3 test-suite:spec:routes] map[node-version:18 ruby-version:3.1 test-suite:spec:security] map[node-version:18 ruby-version:3.3 test-suite:spec:security]]
DEBU[0000] Runner Matrices: map[ruby-version:map[3.1 node-version:18 test-suite:spec:jest:true]]
DEBU[0000] Final matrix after applying user inclusions '[]'

Notice that it seems to take the ruby-version: part as the key and the 3.1 node-version:18 test-suite:spec:jest as the value.

<!-- gh-comment-id:2591167142 --> @Fryguy commented on GitHub (Jan 14, 2025): Ah now I understand - I misunderstood how the matrix parameter works and didn't realize you pass key/value pairs. That being said, the version you specified didn't work and I can't figure out the combo. I can't pass it with spaces between the values, because then it interprets the second value as a filter and I get ``` DEBU[0000] Evaluated matrix inclusions: map[ruby-version:map[3.1:true]] ... DEBU[0000] Using first passed in arguments event for filtering: test-suite:spec:jest DEBU[0000] Preparing plan with a job: ci DEBU[0000] Using first passed in arguments event: test-suite:spec:jest ``` with quotes it seems to parse it incorrectly: ``` --matrix "ruby-version:3.1 node-version:18 test-suite:spec:jest" DEBU[0000] Job Matrices: [map[node-version:18 ruby-version:3.1 test-suite:spec] map[node-version:18 ruby-version:3.3 test-suite:spec] map[node-version:18 ruby-version:3.1 test-suite:spec:compile] map[node-version:18 ruby-version:3.3 test-suite:spec:compile] map[node-version:18 ruby-version:3.1 test-suite:spec:debride] map[node-version:18 ruby-version:3.3 test-suite:spec:debride] map[node-version:18 ruby-version:3.1 test-suite:spec:javascript] map[node-version:18 ruby-version:3.3 test-suite:spec:javascript] map[node-version:18 ruby-version:3.1 test-suite:spec:jest] map[node-version:18 ruby-version:3.3 test-suite:spec:jest] map[node-version:18 ruby-version:3.1 test-suite:spec:routes] map[node-version:18 ruby-version:3.3 test-suite:spec:routes] map[node-version:18 ruby-version:3.1 test-suite:spec:security] map[node-version:18 ruby-version:3.3 test-suite:spec:security]] DEBU[0000] Runner Matrices: map[ruby-version:map[3.1 node-version:18 test-suite:spec:jest:true]] DEBU[0000] Final matrix after applying user inclusions '[]' ``` Notice that it seems to take the `ruby-version:` part as the key and the `3.1 node-version:18 test-suite:spec:jest` as the value.
Author
Owner

@Fryguy commented on GitHub (Jan 14, 2025):

Oh I think I finally got it:

--matrix ruby-version:3.1 --matrix test-suite:spec:jest

DEBU[0000] Evaluated matrix inclusions: map[ruby-version:map[3.1:true] test-suite:map[spec:jest:true]]
...
DEBU[0000] Job Matrices: [map[node-version:18 ruby-version:3.1 test-suite:spec] map[node-version:18 ruby-version:3.1 test-suite:spec:compile] map[node-version:18 ruby-version:3.1 test-suite:spec:debride] map[node-version:18 ruby-version:3.1 test-suite:spec:javascript] map[node-version:18 ruby-version:3.1 test-suite:spec:jest] map[node-version:18 ruby-version:3.1 test-suite:spec:routes] map[node-version:18 ruby-version:3.1 test-suite:spec:security] map[node-version:18 ruby-version:3.3 test-suite:spec] map[node-version:18 ruby-version:3.3 test-suite:spec:compile] map[node-version:18 ruby-version:3.3 test-suite:spec:debride] map[node-version:18 ruby-version:3.3 test-suite:spec:javascript] map[node-version:18 ruby-version:3.3 test-suite:spec:jest] map[node-version:18 ruby-version:3.3 test-suite:spec:routes] map[node-version:18 ruby-version:3.3 test-suite:spec:security]]
DEBU[0000] Runner Matrices: map[ruby-version:map[3.1:true] test-suite:map[spec:jest:true]]
DEBU[0000] Final matrix after applying user inclusions '[map[node-version:18 ruby-version:3.1 test-suite:spec:jest]]'

I wasn't expecting to pass multiple single values, but it seems to work - I'm not sure how one would pass multiple inclusions this way.

<!-- gh-comment-id:2591173194 --> @Fryguy commented on GitHub (Jan 14, 2025): Oh I think I finally got it: ``` --matrix ruby-version:3.1 --matrix test-suite:spec:jest DEBU[0000] Evaluated matrix inclusions: map[ruby-version:map[3.1:true] test-suite:map[spec:jest:true]] ... DEBU[0000] Job Matrices: [map[node-version:18 ruby-version:3.1 test-suite:spec] map[node-version:18 ruby-version:3.1 test-suite:spec:compile] map[node-version:18 ruby-version:3.1 test-suite:spec:debride] map[node-version:18 ruby-version:3.1 test-suite:spec:javascript] map[node-version:18 ruby-version:3.1 test-suite:spec:jest] map[node-version:18 ruby-version:3.1 test-suite:spec:routes] map[node-version:18 ruby-version:3.1 test-suite:spec:security] map[node-version:18 ruby-version:3.3 test-suite:spec] map[node-version:18 ruby-version:3.3 test-suite:spec:compile] map[node-version:18 ruby-version:3.3 test-suite:spec:debride] map[node-version:18 ruby-version:3.3 test-suite:spec:javascript] map[node-version:18 ruby-version:3.3 test-suite:spec:jest] map[node-version:18 ruby-version:3.3 test-suite:spec:routes] map[node-version:18 ruby-version:3.3 test-suite:spec:security]] DEBU[0000] Runner Matrices: map[ruby-version:map[3.1:true] test-suite:map[spec:jest:true]] DEBU[0000] Final matrix after applying user inclusions '[map[node-version:18 ruby-version:3.1 test-suite:spec:jest]]' ``` I wasn't expecting to pass multiple single values, but it seems to work - I'm not sure how one would pass multiple inclusions this way.
Author
Owner

@Fryguy commented on GitHub (Jan 14, 2025):

Closing this, but I might open a separate docs PR to clear up cases like this. Thanks for your help @Andy4495

<!-- gh-comment-id:2591188545 --> @Fryguy commented on GitHub (Jan 14, 2025): Closing this, but I might open a separate docs PR to clear up cases like this. Thanks for your help @Andy4495
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1188
No description provided.