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

fix: job's GetMatrixes cannot get the correct matrix #2649

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

silky1313
Copy link

#2648
This Pull requests is mainly to solve this issue

@silky1313 silky1313 requested a review from a team as a code owner February 7, 2025 09:36
@ChristopherHX
Copy link
Contributor

Thank you for this change, your changed test cache matches my external matrix expansion implementation and my expectations.

I approve (not merge) this from my side if / once CI passes

Copy link
Contributor

mergify bot commented Feb 7, 2025

@silky1313 this pull request has failed checks 🛠

@mergify mergify bot added the needs-work Extra attention is needed label Feb 7, 2025
@ChristopherHX
Copy link
Contributor

TestRunEvent/evalmatrix

seems to fail

@ChristopherHX
Copy link
Contributor

ChristopherHX commented Feb 7, 2025

Something is not correct here to my understanding:

You seem to break somehow this special case

  _additionalInclude_0:
    strategy:
      matrix:
        include:
        - def: val
    runs-on: ubuntu-latest
    steps:
    - name: Check if the matrix key A exists
      run: |
        echo $MATRIX
        exit ${{matrix.def == 'val' && '0' || '1'}}
      env:
        MATRIX: ${{toJSON(matrix)}}
    - run: |
        echo "::set-output name=result::success"
      id: result
    outputs:
      result: ${{ steps.result.outputs.result }}

see this yaml file https://github.com/nektos/act/blob/master/pkg/runner/testdata/evalmatrix/push.yml
I have an implementation, which both passes your changed unit test and this file.
I will run that one now in a private github.com repo again just in cases something is wrong with the test.

The other infrastructure failure e.g.. exit code 137 can be resolved by me just rerunning the job.

confirmed this test has to pass in my point of view
image

running the snapshot shows this bug as well for reference
act -W test3.yml -P ubuntu-latest=-self-hosted

[test3.yml/_additionalProperties_0] 🧪  Matrix: map[def:val x:0 y:0 z:0]
[test3.yml/evalm-1                ] 🧪  Matrix: map[A:A]
[test3.yml/evalm-2                ] 🧪  Matrix: map[A:B]
[test3.yml/_additionalInclude_0   ] ⭐ Run Main Check if the matrix key A exists
[test3.yml/_additionalProperties_0] ⭐ Run Main Check if the matrix key A exists
[test3.yml/evalm-1                ] ⭐ Run Main Check if the matrix key A exists
[test3.yml/evalm-2                ] ⭐ Run Main Check if the matrix key A exists
[test3.yml/_additionalInclude_0   ]   | {}
[test3.yml/evalm-1                ]   | { "A": "A" }
[test3.yml/_additionalInclude_0   ]   ❌  Failure - Main Check if the matrix key A exists
[test3.yml/evalm-1                ]   ✅  Success - Main Check if the matrix key A exists
[test3.yml/_additionalProperties_0]   | { "def": "val", "x": 0, "y": 0, "z": 0 }
[test3.yml/_additionalProperties_0]   ✅  Success - Main Check if the matrix key A exists
[test3.yml/evalm-2                ]   | { "A": "B" }
[test3.yml/evalm-2                ]   ✅  Success - Main Check if the matrix key A exists
[test3.yml/_additionalInclude_0   ] exit status 1
[test3.yml/evalm-1                ] Cleaning up container for job evalm
[test3.yml/evalm-2                ] Cleaning up container for job evalm
[test3.yml/evalm-1                ] 🏁  Job succeeded
[test3.yml/evalm-2                ] 🏁  Job succeeded
[test3.yml/_additionalInclude_0   ] 🏁  Job failed
[test3.yml/_additionalProperties_0] ⭐ Run Main echo "::set-output name=result::success"
[test3.yml/_additionalProperties_0]   ⚙  ::set-output:: result=success
[test3.yml/_additionalProperties_0]   ✅  Success - Main echo "::set-output name=result::success"
[test3.yml/_additionalProperties_0] Cleaning up container for job _additionalProperties_0
[test3.yml/_additionalProperties_0] 🏁  Job succeeded
[test3.yml/_additionalInclude_1   ] ⭐ Run Main Check if the matrix key A exists
[test3.yml/_additionalProperties_1] ⭐ Run Main Check if the matrix key A exists
[test3.yml/_additionalInclude_1   ]   | 
[test3.yml/_additionalInclude_1   ]   ❌  Failure - Main Check if the matrix key A exists
[test3.yml/_additionalInclude_1   ] exit status 1
[test3.yml/_additionalInclude_1   ] 🏁  Job failed
[test3.yml/_additionalProperties_1]   | 
[test3.yml/_additionalProperties_1]   ✅  Success - Main Check if the matrix key A exists
[test3.yml/_additionalProperties_1] Cleaning up container for job _additionalProperties_1
[test3.yml/_additionalProperties_1] 🏁  Job succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-work Extra attention is needed size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants