-
I build several subprojects using a job with the matrix strategy. The matrix is dynamic - depends on the branch used. All of those matrix jobs need to succeed for the code to be good to merge. But I fail to find a way how to check the composite status of the branches. Which direction would you recommend? |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 11 replies
-
Do you mean that you set different matrix configurations in the workflow on different branches?
What do you mean about “the composite status of the branches”? If I missed something, feel free to tell me. And if possible, you also can share your repository with us, so that we can check more detailed configurations related to the workflow. |
Beta Was this translation helpful? Give feedback.
-
I’m using a job that
In the example above, |
Beta Was this translation helpful? Give feedback.
-
brightran:
Yes.
brightran:
PR can be merged only if all of the jobs from the calculated matrix complete successfully. If a single job from the matrix fails, the PR merge should be blocked.
brightran:
I don’t understand where and what would I dispatch and how would that help.
ylemkimon:
This gives false-positives - if one of matrix
brightran:
I might generate trivial artifacts from each running matrix job and have a job that checks the existence of those based on matrix, but that sounds over-engineered. Hoping to find something more simple. |
Beta Was this translation helpful? Give feedback.
-
@edzis , The checks of a PR generally include the jobs in the workflows related to the PR, and some checks generated from other GitHub Apps.
Normally, the workflows run on other branches that not related to the PR will not affect to this PR. If you want the related checks on the PR must be passed before the PR can be merged, you can set some branch protection rules, and set the related checks as ‘Required’. More details, see “Defining the mergeability of pull requests”. |
Beta Was this translation helpful? Give feedback.
-
@brightran I believe we are not on the same page. I believe it might help for me to share more insights about the setup. Here is a short description and the action setup is shared on https://gist.github.com/edzis/17602cb75eb6346b9096b7b53498a424 Conceptually we have a monorepo with multiple projects (customizers) and a shared codebase used by those projects. Any ideas how I can check if all the jobs defined by the matrix have succeeded?
|
Beta Was this translation helpful? Give feedback.
-
Hi @edzis, This is a workaround using a utility job (
In addition, I think you should have |
Beta Was this translation helpful? Give feedback.
-
Thanks @hodbn, that fixes my issue! I was not aware of
and
And I tried |
Beta Was this translation helpful? Give feedback.
-
@hodbn @edzis this solution does not seem to work. |
Beta Was this translation helpful? Give feedback.
-
Is there any update on this? @dudicoco is correct that if any of the matrix jobs are successful then I have a matrix build that builds any projects that have changed in our mono-repo. I then want to have a single job that runs after so I can configure the github branch protection to require that single job, which would accumulate the results of the matrix job (i.e. if any of the matrix jobs fail, it would also fail) I could achieve this by turning off |
Beta Was this translation helpful? Give feedback.
-
@egmacke I was able to solve this using the following suggestion: Get status of parallel jobs into a single Webhook payload - #2 by weide-zhou |
Beta Was this translation helpful? Give feedback.
-
@dudicoco thanks! That looks like a nice solution. However, since posting, I’ve come up with a different alternative, which is to add an additional step in the matrix job that adds a tag to the pull request if it fails. Then I have a final job that checks if the tag has been added or not. I’ll have a look and see which approach is better for my use case, but thanks for the link! For reference for anyone else coming here:
|
Beta Was this translation helpful? Give feedback.
-
late to the party but looks like so I can have just one single additional job which I can set as required
|
Beta Was this translation helpful? Give feedback.
late to the party but looks like
result
of matrix now works as expected when using:needs.<job_id>.result
so I can have just one single additional job which I can set as required