I seem to be hitting a wall I can’t figure out. I’m trying to add a matrix to a CircleCI workflow but it just doesn’t like me. My config (partially) looks like:
Thanks for bringing up this interesting question; it led me to look into a parameter type I rarely get a chance to use, namely the executor type.
There are a couple of things I’d like to point out in your initial config.yml:
The error you initially mentioned was occurring because the parameter named executor specified in the matrix jobs had not previously been defined.
As you’ve figured out, you need to declare said parameter in the jobs respective declaration.
The line executor: << matrix.executor >> would also generate an Unknown variable(s) error because the job declaration should be independent of how it’ll be used downstream.
The command << matrix.executor >> --version would fail for 2 reasons:
As above, the use of << matrix.executor >> would lead to an Unknown variable(s) error
Even with the use of an appropriate parameter, the command << matrix.executor >> --version (or let’s say << parameters.compiler >> --version) would fail; both gfortran and ifort are defined as executors, so the command would be interpolated with the whole block defining gfortran and ifort which wouldn’t make sense, and cause a command not found error.
As I initially hinted at, you can use the executor type for your jobs’ parameter. Please find below a configuration suggestion:
Regarding your remark about the space after requires:, I can confirm this is actually not required, but it could be that you fixed an incorrect indentation at the same time; YAML is quite sensitive to indentation