Backend: Implement support for "null" value to remove parent node
Problem
GitLab CI/CD currently supports using null (or leaving a keyword value empty) to effectively "unset" keywords, but this behavior is undocumented and unofficial.
For example:
test_job:
image: # equivalent to image: null
script: echo 123
This works - the null value causes the keyword to be removed, and the job falls back to default behavior. However:
- This is not documented in our CI/CD YAML reference
- Users don't know they can rely on this behavior
- It's unclear which keywords support this pattern
- We're implementing nullable inputs (Introduce nullable input types (#439524)) which depends on this functionality
Proposal
- Document the behavior in our CI/CD YAML reference:
- Explain that
keyword: null(orkeyword:with no value) removes the keyword - Clarify that this is different from empty values like
''or[] - Provide examples of common use cases (especially with
extendsand components)
- Explain that
- Add test coverage to ensure this behavior is consistent:
- Verify which keywords support null values
- Test that null properly removes inherited values
- Ensure validation doesn't treat null and empty values the same
- Update CI Editor schema if needed to reflect that null is a valid value
Scope
Initial scope should cover commonly-used keywords where null removal is useful:
- needs - remove dependency, revert to stage-based execution
- image - remove custom image, use default
- rules - remove inherited rules
- tags - remove runner tag requirements
Explore applying it to all keywords.
Edited by 🤖 GitLab Bot 🤖