firecow / gitlab-ci-local

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

Fix list-json rules by only returning rules if defined #1421

Closed ekohilas closed 1 week ago

ekohilas commented 2 weeks ago

list-json was returning null in json for rules output when the rules were undefined

ANGkeith commented 2 weeks ago

hmm, i feel the current behaviour is correct,

since

---
job:
  script:
    - echo "should always run"

job2:
  rules: [] # kinda a gcl bug .. on gitlab-ci this is an invalid config
  script:
    - echo "should never run"

job3:
  rules: null
  script:
    - echo "should always run"

an alternative is that we can delete the rules key from the json output when it's undefined instead of showing rules: null

ekohilas commented 2 weeks ago

Ah that's a good perspective. Thanks I'll update for that :blush: