-
Notifications
You must be signed in to change notification settings - Fork 51
Schema validation errors for dynamic job name within azure pipeline #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't know that there's anything the checker can do in this case out of the box. The azure pipelines schema doesn't really describe what those files can contain. I don't want that to be my final answer -- even weak validation is worth something -- but it is my starting point. I'm thinking about how to work around this without trying to really implement their expression language (that seems very fraught to me). What if I offered an option to replace strings prior to validation, such that you could write in your config add_args: ["--replace-string", "${{ parameters.name }}", "dummy-job-name"] ? Would that be sufficient and interesting to you as a user? I might not want to make it a CLI option, perhaps config instead, but that would be the idea of it. |
Json path might be cleaner via a config as our pipelines are utilizing the templated job names quite a bit.. Some come from variables, some come from parameters so replace-string may be hard to scale. If we could some how ignore values in certain json paths it might be more flexible and scalable. |
I wish we could. I agree that it would work better from a user-perspective: you get an error from the linting and you effectively say "ignore that error". I'll try to make time soon to work on some kind of replacer config, since that's the best workaround I can come up with. |
Ran into something similar as mentioned here. I'm using check-json-schema to validate my Azure Devops pipeline templates and one template uses the TerraformV4@4 task. This has an input called steps:
- task: TerraformTaskV4@4
displayName: "Terraform ${{ parameters.command }}"
inputs:
provider: "azurerm"
command: ${{ parameters.command }} # this breaks the json schema validation. I already removed the name because of the same issue. It would be valuable if we could somehow make the validation work. Maybe by replacing it with the default value of the parameter?? |
@sirosen @robertaves steps:
- task: TerraformTaskV4@4
displayName: "Terraform ${{ parameters.command }}"
inputs:
provider: "azurerm"
${{ if eq(parameters.command, 'init') }}:
command: "init"
${{ elseif eq(parameters.command, 'validate') }}:
command: "validate"
${{ elseif eq(parameters.command, 'show') }}:
command: "show"
${{ elseif eq(parameters.command, 'plan') }}:
command: "plan"
${{ elseif eq(parameters.command, 'apply') }}:
command: "apply" |
Problem:
When using expressions for job names we get a Schema validation error.
Error:

Setup:
Note this also errors out in the Azure Server Lang plugin as well as it can't validate the schema

The text was updated successfully, but these errors were encountered: