Skip to content
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

AzurePipelinesDataError on valid expression syntax #162

Closed
robertaves opened this issue Oct 14, 2022 · 2 comments · Fixed by #166
Closed

AzurePipelinesDataError on valid expression syntax #162

robertaves opened this issue Oct 14, 2022 · 2 comments · Fixed by #166
Assignees
Labels
bug Something isn't working

Comments

@robertaves
Copy link

Looking to validate my Azure pipelines and have run into a blocker. I currently have a pipeline in production ( working and running ) with the following syntax

 steps:
      - bash: |         
          pipenv run pip install ansible-lint-junit --upgrade
          pipenv run ansible-lint -c ../.config/ansible-lint.yml -p --nocolor > ansible-lint.txt
          pipenv run ansible-lint-junit ansible-lint.txt -o AnsibleLintReport.xml
        displayName: "Lint"
        workingDirectory: ${{parameters.workdir}}
        env:
          ${{ each pair in parameters.env }}:
            ${{ pair.key }}: ${{ pair.value }}

when running with the pre-commit hook

        - repo: https://github.com/python-jsonschema/check-jsonschema
          rev: 0.18.3
          hooks:
            - id: check-azure-pipelines
              files: '^.azure/.*\.yml'

it currently raises the error

  raise AzurePipelinesDataError(
  check_jsonschema.transforms.azure_pipelines.AzurePipelinesDataError: azure-pipelines transform: found non-object data under an expression in an object, expression=${{ pair.key }}
@sirosen sirosen added the bug Something isn't working label Oct 17, 2022
@sirosen sirosen self-assigned this Oct 17, 2022
@sirosen
Copy link
Member

sirosen commented Oct 17, 2022

Hi, thanks for reporting this!
It looks to me like a bug in check-jsonschema, but I'm not sure exactly how to resolve it. I'll need to think more about this and study a bit.

By way of explanation / background, Azure Pipelines files don't pass under their schema (!). Since Microsoft provides a VSCode plugin using LSP, we know they're doing something to make the schema work - I had a productive exchange with one of the devs on the plugin code, and ended up copying their approach of rewriting the pipeline to "unnest" expressions.
It looks like they may have found and fixed this exact case a couple of months ago ( microsoft/azure-pipelines-language-server#130 , assuming I'm reading that PR right), which may be useful to read.

@sirosen
Copy link
Member

sirosen commented Oct 24, 2022

I've just released v0.18.4 which ought to fix this issue. Please let me know if the fix doesn't work for you or if you're seeing other problems with the Azure Pipelines handling!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants