Files
glint/testdata/needs.yml
T
k3nny d34c39927d
release / Build and publish release (push) Successful in 1m12s
fix(linter): downgrade needs optional:true missing-job to warning
parseNeedJobNames is replaced by parseNeedEntries which preserves the
optional flag from each needs: entry. When a referenced job does not
exist and optional:true is set, the finding is now WARNING instead of
ERROR, matching GitLab CI runtime behavior (the dependency is silently
skipped when the job is absent from a conditional include).

Optional missing deps are also excluded from the cycle-detection graph
since there is no real dependency edge to trace.

Adds a fixture case in testdata/needs.yml to prevent regression.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 21:27:16 +02:00

50 lines
903 B
YAML

stages:
- build
- test
- deploy
build-job:
stage: build
script:
- go build ./...
test-job:
stage: test
script:
- go test ./...
needs:
- build-job # OK: build comes before test
deploy-job:
stage: deploy
script:
- echo "deploy"
needs:
- job: test-job
artifacts: true # OK: test comes before deploy
# Bad: needs a job in a later stage
bad-needs-job:
stage: build
script:
- echo "bad"
needs:
- test-job # ERROR: test is after build
# Bad: needs a job that doesn't exist
missing-needs-job:
stage: test
script:
- echo "bad"
needs:
- nonexistent-job # ERROR: job doesn't exist
# optional: true — missing dep should be WARNING not ERROR
optional-needs-job:
stage: build
script:
- echo "I depend on something that may not exist"
needs:
- job: nonexistent-optional-job
optional: true