Include strategy matrix property based on existing matrix nested object #26779
-
I have a general list of objects which I would like to reuse across environments. This list of objects is used as the strategy matrix in e.g. a deploy-development job.
In the deploy-development job, I need to have a property added to the matrix which is dependent on the entry of my matrix’s current value.
What I’m trying to accomplish here is to add a new property (new_property) with a given value (new_property_value), when my matrix entry’s name is name-1. The reason I need this functionality, is because there is values which is specific for the matrix entry and the environment combined. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Surprise surprise, I actually didn’t check this current way of doing it, and it actually works ^^’. If anyone was wondering about sharing the same matrix across jobs, I used this way of doing it. If that link somehow dies in the future, here is the job that does it:
It retrieves the json file and appends it as an output variable. Whenever you need to consume it, run ${{ fromJson(needs.matrix-builder.outputs.matrix }} as seen in the original post. |
Beta Was this translation helpful? Give feedback.
-
FWIW, the documentation has an example of sharing matrices between jobs: Expressions - GitHub Docs |
Beta Was this translation helpful? Give feedback.
Surprise surprise, I actually didn’t check this current way of doing it, and it actually works ^^’.
I think the include checks if the matrix entry has a property called name, and if it’s the same value. If so, the new_property is added.
If anyone was wondering about sharing the same matrix across jobs, I used this way of doing it.
If that link somehow dies in the future, here is the job that does it: