I’ve got an orb where I’m trying to support enabling
I’m pretty sure I can’t suppress the entire block using mustache templating, right?
I was trying to use ~ or null in the case where the parameter isn’t set, but in that case, it still tries to add /home/circleci or /home/circleci/null to the saved cache.
I tried suppressing the entire block (by putting the - inside the <<#... bit) just to see if it would work, and while it didn’t throw validation errors, it also didn’t do what I would want / expect. And I think when: and other conditions only work for, e.g., steps, right?
There’s also no way to make a list parameter, right (for passing into paths:)?
I think that it is still the case that past posts from you are still about the only place that mustache templating gets raised in the forums and CirclCI staff have not touched upon the feature much beyond the following tech note
The real unknown is where within the config.yml file processing path is the Mustache Conditionals step performed as the circleci DSL has 2 forms of parameter - those fully defined/known at the start (signified by having a name starting with “pipeline.” or “pipeline.parameters.” and those only fully defined during execution (signified by having a name starting with “parameters”).
I can only guess, but much of the processing of the config.yml treats these 2 forms of parameter very differently with certain processing only performed at the time that config.yml is first loaded. Mustache Conditional processing is likely to be performed only at this stage.
This issue of parameter types is also likely to be limiting your ability to use a parameter as a list for paths: such a configuration may work if you were using a pipeline or pipeline.parameters type.
I realized last night that in theory, it could be possible to do using steps conditionally, but you’d have to do it in a much messier / less terse way. Something like (untested)