I am trying to test and build for multiple operating systems and so I use a matrix that looks something like this
os: [linux, macos, windows]
Where os is an executor.
But for each one I want to do conditional setup steps based on the executor type and I couldn’t find a way to do that.
equal: [ macos, << parameters.os >> ]
but the condition is never true as << paramaters.os >> seems to be converted into an executor object string and so it is not the same as macos even when the executor type is called macos.
How can I achieve something like this?
I have a sample config.yml file that might be useful to reference.
It can also be viewed at: Conditional executor config · GitHub
- image: cimg/base:2020.01
- run: echo "test"
os: ["linux", "mac", "win"]
In the above, I am defining three executors, “linux”, “mac”, and “windows”.
Then I set the executor for the job to equal the name of the executor being passed in by the pipeline variable “os”. This will run the job
test for each executor named in the matrix.
For more information regarding executors and conditional workflows, please take a look at the following sections in our documentation:
Let me know if this helps.
Thank you! That solves my problem!
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.