Allow Matrix to be defined within a step itself #2487
Unanswered
Andre601
asked this question in
Request a Feature
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Idea
It could be a useful feature to allow defining a Matrix within a step itself, instead of only for the whole workflow itself.
One main reason is to reduce duplicate actions that could easily be done within a single step alone, rather than re-doing them within each matrix itself.
The syntax would effectively be the same as with the global setting, just within a step itself, meaning that a matrix setup like this:
...would look like this when included within a step:
Problems
There would obviously be some problems that may or may not be avoidable.
I don't have the technical knowledge to say for certain if the mentioned issues are valid or not.
Matrix values could only be used within commands/steps?
With these matrix options being defined within a step itself, it would obviously be limited to just this step alone and couldn't be used across the entire file like with the global one.
Global and per-step matrix mixing
This could be an issue where a user may want to try and use a matrix for the file globally, while also wanting to have one within a step.
This setup could result in
n1*n2
individual steps where n1 is the global matrix number and n2 the step matrix number (So a setup using 3 entries on global matrix and 4 entries on step matrix would result in 12 runs, only assuming a single step with matrix configuration is used).I believe that such combinations should be treated as an invalid file configuration by Woodpecker to avoid possible abuse cases where a person creates a global matrix with
n
entries and multiple steps withn
steps...In general should it perhaps be considered to limit number of matrix configurations within a step to 1... mainly because of...
Problems defining matrix step -> matrix step progression
...how should a situation like this be handled?
If we would just make a matrix step for each previous matrix step would this be the result:
3 separate steps produced by the first step, which then results in three steps for each caused by the next step.
Depending on what is done in the commands could this significantly increase stress on the CI, which is why I repeat my suggestion of limiting matrix usage within a step itself to one step only.
How should files propagate?
This is another difficult decision here... If the matrix involves creating and managing files, how should they propagate for non-matrix steps?
Should the follow-up steps be duplicated for each matrix entry? Should all matrix merge back?
Perhaps this could be regulated by a setting that decides how the matrix step should complete here, with default being duplicating the follow-up steps and run in parallel.
To give a visual example again, using this setup here:
would give this flow if follow-up steps are duplicated for each matrix entry:
Meanwhile with merging the matrixes back together in 1 follow-up step to use, this would be the flow:
The question with merging would be, what to do with conflicting files?
Perhaps a config option to define this could be used with the option being to fail the run, but also allowing overrides or "merging" them (i.e. appending values together).
Order would be the same as with the list, meaning that with above example (And assuming the same file is used for all matrix entries) and using override, lorem would go first, them dolor would override it followed by amet overriding dolor.
How to handle failed runs in a matrix?
Probably the same as with current global matrix settings... Maybe also allow to define the action: cancel run, ignore (continue), ...?
Actual example use-case
I'm using a possible use-case here I myself would've had in the past (Tho not anymore now) to give an idea of why such a feature could be beneficial.
I cannot guarantee this example is valid in terms of parameters and alike...
Closing words
I hope the examples and descriptions I gave make it clear what my idea is. I want to also reiterate that I'm aware of possible issues and limitations that would need to be thought about here... in fact did some issues pop up in my mind while I was writing some of the examples...
I understand if this would be a too complex or too niche thing to consider. Was just some "food for thought" I would say...
The idea is inspired by GitHub Actions' support of matrix per-step, which works since it doesn't have the "files are taken to the next step" situation here... which is also a downside of sorts.
Beta Was this translation helpful? Give feedback.
All reactions