firecow / gitlab-ci-local

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

Checking the absence of a variable with `rules: -if: (! $VARIABLE)` works in `gitlab-ci-local` but is rejected as invalid YAML by GitLab! #1189

Closed sh-cau closed 1 month ago

sh-cau commented 2 months ago

Minimal .gitlab-ci.yml illustrating the issue

---
job:
  riles:
    - if: (! $VARIABLE) 
   script:
    - echo "Should throw an error! This is not accepted by the GitLab yml parser, e.g. 'glab ci lint this-file.yml'

Expected behavior gitlab-ci-local should throw an error when the syntax if: (! $VARIABLE) is used

Host information Ubuntu 20.04 LTS gitlab-ci-local 4.47.0

Containerd binary No

Additional context

ANGkeith commented 2 months ago

Hi

This should be resolved in 4.48.2, by enabling the experimental json schema validation option via

export GCL_ENABLE_JSON_SCHEMA_VALIDATION=true

image

(the additional spaces infront of the word stages is a bug, will fix it)