Switched Web IDE to local schema for CI config
What does this MR do and why?
There are issues with fetching the CI config schema from a remote. Especially for the self-hosted instances. In ab875500 the schema from the schemastore has been copied over to GitLab to be hosted as an asset locally. The pipeline editor has been updated to use it since %14.4 behind the feature flag. Web IDE, on another hand, was continuing using the remote one, hosted on the schemastore.
This MR unifies the CI linting capabilities by switching Web IDE to use the local schema instead of the remotely hosted one. The MR does protect the change with the same feature flag as the Pipeline Editor (:schema_linting). The flag is globally enabled on gitlab.com for several milestones, and the lining has been working perfect in the Pipeline Editor. In case the flag is disabled, Web IDE will go on and fetch the CI linting schema conventionally from schemastore. To visually describe the conditions, introduced in this MR, here's the flowchart for your convenience:
flowchart TB
id1{is .gitlab-ci.yml file?}
id2{is flag ON?}
id3{is the extension installed?}
id31{is the extension installed?}
id4[register external schema]
id5[register local schema]
id6[unuse the extension]
id7[use local extension]
id8[fetch, store and use extension]
id1-->|No|id3
id3-->|No|id4
id3-->|Yes|id6
id1-->|Yes|id2
id2-->|No|id4
id2-->|Yes|id5
id6-->id4
id5-->id31
id31-->|Yes|id7
id31-->|NO|id8
The feature flag's roll-out issue is a wip and the flag will be enabled by default (incl. the self-hosted instances) in %15.7.
Screenshots or screen recordings
Some things to note in the screenshots below:
- the Pipeline Editor's state is identical before this MR and after and is affected only with the feature flag
- Web IDE
Before (flag ON)andAfter (flag OFF)states are identical toBefore (flag OFF)- in all these cases, Web IDE will reach out to schemastore - The only change in the set of
Afterstates compared toBeforeis the Web IDE'sAfter (flag ON)- that's where we reach out to the locally hosted schema
How to set up and validate locally
- Locally, in a project containing
.gitlab-ci.ymlfile, go to Web IDE and open the file - In the DevTools, note the unsuccessful request (422 response) to
.gitlab-ci.ymlworker and the interlining of the very first character in the editor. Hovering over it will show an error (see the screenshot above) - In the terminal, go to the Rails console
rails c - Enable the
:schema_lintingflag:Feature.enable(:schema_linting) - Reload the browser (it might take some hard reload as it might take some time for the feature flag changes to be available in the browser). Note that the unsuccessful worker request has been replaced with a successful request to
ci.SOME_HASH.jsonfile. - The error and underlining on the first character in the editor should also be gone
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #371600 (closed)



