Template variable file paths are not processing parameters or variables
Given the below example foder/file structure it should be possible to do a repro.
The files are typed mostly out of memory, so there might be small typos, please excuse me for that. But the pipeline runs completely fine in Azure DevOps, so it got me triggered to file an issue here.
filesystem/repo:
/devops/azure-pipeline.yml
/devops/templates/template.yml
/infra/tenants/a/subs/a/variables.yml
azure-pipeline.yml:
stages:
- ${each tenant in parameters.tenants}:
- ${each sub in tenant.subs}:
- template: templates/stage.yml
parameters:
tenantName: ${{ tenant.name }}
subName: ${{ sub.name }}
stage.yml:
parameters:
- name: tenantName
type: string
default: ''
- name: subName
type: string
default: ''
stages:
- stage:
variables:
- template: ../../infra/tenants/${{parameters.tenantName}}/subs/${{parameters.subName}}/variables.yml
variables.yml:
variables:
- name: location
value: eastus
```
**Validation outcome**:
> Couldn't read template ../../infra/tenants//subs///variables.yaml resolved to infra/tenants/subs/variables.yaml (self)
**Seems like this is the issue**:
Calculating the path is missing the access to the parameters, so it replaces them with empty string
Further, the path treats `//` or `///` as a single `/`
This does work in real life, so it's a false negative
You might need to provide more context, the minimal example works on my end (syntax errors removed, but not far away from your post) I have attached it here for reference: test.zip
Using [ { name: a, subs: [{ name: a }] } ] as input if the extension asks about the required parameter
I seem to get an idea what you mean
Pressing Expand yaml on stage.yml will cause this error, due to having non required parameters that have default value ""
Pressing Expand yaml on azure-pipelines.yml works
- This validates stage.yml and all other nested templates with parameters it provides to them