Skip to content

Update app/assets/javascripts/editor/schema/ci.json to accept

What does this MR do and why?

This merge request updates the json schema to allow VSCode to validate the usage of a Variable in the include.project field. This is a valid usage of a Variable that may be defined at the Project, Group, or Instance scope.

The schema requires either a group/project or $SOME_VARIABLE pattern for editor to validate files.

Screenshots or screen recordings

Before updating the schema:

image

After updating the schema:

image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Open VSCode settings.json file.
  2. Pass the path to the schema
"yaml.schemas": {
       "/path/to/schema/ci.json": ".gitlab-ci.yml"
    },

This should validate the following properly with hello being invalid by design:

include:
    - project: hello
      ref: $CUSTOM_TEMPLATES_REF
      file: my/goofy/job.gitlab-ci.yml
    - project: hello/world
      ref: $CUSTOM_TEMPLATES_REF
      file: my/goofy/job.gitlab-ci.yml
    - project: $CUSTOM_TEMPLATES_PROJECT
      ref: $CUSTOM_TEMPLATES_REF
      file: my/goofy/job.gitlab-ci.yml

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tanner Bragg

Merge request reports

Loading