firecow / gitlab-ci-local

Tired of pushing to test your .gitlab-ci.yml?
MIT License
2.03k stars 115 forks source link

Do not validate formats and remove all string patterns from schema.json #1248

Closed firecow closed 1 month ago

firecow commented 1 month ago
---
test:
  environment:
    name: test
    url: ''
  script: hello

This make gitlab-ci-local go boom.

But gitlab is fine with it :smile: Which leaves me to believe that they aren't enforcing their json schema string patterns or formats, so let's ignore them for now.

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

ANGkeith commented 1 month ago

I see that they’ve accept @PigeonF mr. https://gitlab.com/gitlab-org/gitlab/-/issues/462979#note_1923462655

Our developers found many issues today with this approach, a lot of local pipelines was failing.

is there a lot of error with the json schema? Or is it worth the trouble to fix our schema and contribute upstream to gitlab.com

firecow commented 1 month ago

I see that they’ve accept @PigeonF mr. https://gitlab.com/gitlab-org/gitlab/-/issues/462979#note_1923462655

Our developers found many issues today with this approach, a lot of local pipelines was failing.

is there a lot of error with the json schema? Or is it worth the trouble to fix our schema and contribute upstream to gitlab.com

After some digging around, its only the string pattern and formats that weren't being upheld by Gitlab CI/CD, so those were the only issues we ran into.

We cannot contribute to upstream Gitlab.com on how they interpret their json schema in Gitlab CI/CD can we?

ANGkeith commented 1 month ago

We cannot contribute to upstream Gitlab.com on how they interpret their json schema in Gitlab CI/CD can we?

Not sure, maybe we can create a “feature request” for it.

There might be some reasons / limitation why they did not conduct the schema validation on the backend😅 But looking at the current state, there’s still some tuning that needs to be done in the json schema specification otherwise it’ll result in breaking changes to current user

contribute upstream to gitlab.com

I am referring to contributing to the json schema as per what pigeonf done

firecow commented 1 month ago

Aaah, well.. I haven't found any mistakes in the json schema definition, though, just stuff that Gitlab ignores in their CI Linting. If we find any errors, lets contribute to the schema.

PigeonF commented 1 month ago

There might be some reasons / limitation why they did not conduct the schema validation on the backend😅

I believe they do not do any schema validation on the backend - they do the validation in the ruby code (e.g. here). As far as I can tell, the schema is only used for the pipeline editor web UI.