redhat-developer / vscode-yaml

YAML support for VS Code with built-in kubernetes syntax support
MIT License
665 stars 222 forks source link

.gitlab-ci.yml - Custom tag !reference defined in schema but reported as error. #925

Open gone-for-coding opened 1 year ago

gone-for-coding commented 1 year ago

Describe the bug

Expected Behavior

This code is actually valid:

.gitlab-ci.yml

.common:
  before_script:
    - git config --global credential.helper store

.job:
  before_script:
    - !reference [.common, before_script]

The correct schema is loaded: https://github.com/SchemaStore/schemastore/blob/master/src/api/json/catalog.json#L1732 https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/editor/schema/ci.json#L29

Current Behavior

Problems are raised for each !reference tag in the file: Unresolved tag: !reference

Steps to Reproduce

Use the above mentioned file.

Environment

aol-nnov commented 1 year ago

I can confirm it is reproduced on Mac OS, too.

gjrtimmer commented 11 months ago

It is still an issue; MacOS Sonoma, latest vs code

gjrtimmer commented 11 months ago

I fixed it by adding the following in my settings.yml of vscode

"yaml.customTags": [
      "!reference sequence"
  ],
GiancarlosIO commented 1 month ago

I have added the configuration suggested by @gjrtimmer but still getting an error 😢

{
    "yaml.customTags": ["!reference sequence"]
}

image

acdha commented 3 weeks ago

I have added the configuration suggested by @gjrtimmer but still getting an error 😢

{
    "yaml.customTags": ["!reference sequence"]
}

I think this is actually an issue with the schema which GitLab publishes. I just encountered that same error for a services block as well as the rules block you referenced, but they do work for before_script and script so I opened a GitLab issue about the schema after confirming that validation passes if I add {"$ref":"#/definitions/!reference"} to the list of allowed values for that schema:

https://gitlab.com/gitlab-org/gitlab/-/issues/500564