Skip to content

check-gitlab-ci fails to parse multi-document .gitlab-ci.yml #561

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

Open
p-rogalski opened this issue Apr 22, 2025 · 1 comment
Open

check-gitlab-ci fails to parse multi-document .gitlab-ci.yml #561

p-rogalski opened this issue Apr 22, 2025 · 1 comment

Comments

@p-rogalski
Copy link

GitLab recently added the spec:inputs CI/CD YAML keyword which makes use of multi-document YAML files. The following example is taken straight from their docs:

spec:
  inputs:
    job-stage:
      default: test
    environment:
      default: production
---
scan-website:
  stage: $[[ inputs.job-stage ]]
  script: ./scan-website $[[ inputs.environment ]]

However, check-jsonschema refuses to parse such a file and errors out:

> check-jsonschema.exe --verbose --schemafile https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json .\.gitlab-ci.yml
Several files failed to parse.
  FailedFileLoadError: Failed to parse .\.gitlab-ci.yml
    in "C:\Users\username\pipx\venvs\check-jsonschema\Lib\site-packages\check_jsonschema\instance_loader.py", line 50
    >>> data: t.Any = self._parsers.parse_data_with_path(

    caused by

    ComposerError: expected a single document in the stream
      in "<byte string>", line 2, column 1:
        spec:
        ^ (line: 2)
    but found another document
      in "<byte string>", line 10, column 1:
        ---
        ^ (line: 10)
      in "C:\Users\username\pipx\venvs\check-jsonschema\Lib\site-packages\check_jsonschema\parsers\__init__.py", line 102
      >>> return loadfunc(data)
@p-rogalski p-rogalski changed the title check-gitlab-ci fails to parse multi-document .gitlab-ci.yml check-gitlab-ci fails to parse multi-document .gitlab-ci.yml Apr 22, 2025
@sirosen sirosen added upstream-schema-issue An issue with a schema or schema provider and removed upstream-schema-issue An issue with a schema or schema provider labels Apr 22, 2025
@sirosen
Copy link
Member

sirosen commented Apr 22, 2025

At first I was going to mark this as an upstream issue -- I thought the GitLab schema needed updates -- but now I think this is more or less the same feature idea as #222 . I'm therefore marking this as a feature request, and I'll keep it tracked separately since the requirement here is slightly different from generic multi-document-YAML-file support.

In order for this to work, we not only need multi-document support, but also to flag that to the gitlab hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants