I have a matrix in a multi-stage pipeline that generates jobs to go and checkout to different git repositories and make commits.
The matrix has the repo name as a value, and I want to reference that during a checkout
task. However I keep getting errors due to the variable being evaluated at runtime.
i.e. matrix
matrix:
repo_foo:
repo: foo
repo_bar:
repo: bar
and I want to do something like
steps:
- checkout: $[ variables['repo'] ]
but those isn't evaluated and throws an error before the pipeline starts. Similarly, using ${{ variables['repo'] }}
also fails because it gets evaluated at compile time and thus becomes an empty string.
I've defined the potential repos as resources in the pipeline yaml, as well as attempting to pass the full git path as the variable value.
Is there another way I can do this?