Excluding struct from matrix doesn't work
See original GitHub issueDescribe the bug I have a workflow like this:
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
attr1:
- key1: val1
key2: val2
- key1: val3
key2: val4
attr2:
- key1: val5
key2: val6
key3: val7
- key1: val8
key2: val9
key3: val10
steps:
- run: |
echo ${{ matrix.attr1.key1 }}
echo ${{ matrix.attr1.key2 }}
echo ${{ matrix.attr2.key1 }}
echo ${{ matrix.attr2.key2 }}
echo ${{ matrix.attr2.key3 }}
That is to say, there are two attributes attr1
and attr2
(can be more in practice) in the matrix, with each one using “structs” as alternatives rather than string literals. This allows me to tie additional information with the key. The syntax is legal according to https://github.com/actions/runner/issues/343#issuecomment-590634907 and works well in practice. Note that the jobs (attr1.key1, attr1.key2, attr2.key1, attr2.key2, attr2.key3) triggered are:
- (val1, val2, val5, val6, val7)
- (val1, val2, val8, val9, val10)
- (val3, val4, val5, val6, val7)
- (val3, val4, val8, val9, val10)
However, I’m unable to exclude configurations from the matrix. For example, the following doesn’t work:
exclude:
- attr1:
- key1: val1
key2: val2
To Reproduce Run the above workflow with the excluding rule added.
Expected behavior Only
- (val3, val4, val5, val6, val7)
- (val3, val4, val8, val9, val10)
get triggered.
Runner Version and Platform
2.284.0 (Github hosted runner)
OS of the machine running the runner? ubuntu-20.04 20211122.1
What’s not working?
All four jobs got triggered.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top GitHub Comments
Thanks for the response, feel free to close this issue.
Hey! Excuse me for writing here. I have a similar issue (well, at least it’s the closest I could find).
I’m using the “include” syntax to build multiple services (in this case, two). Is there any way to exclude some of them? I was thinking about adding the
shouldBuild
boolean flag and then checking it. I could’ve just addedif
to my job, but I don’t think it’s clean.Should I create a new issue for this?..