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

  1. Document the behavior in our CI/CD YAML reference:
    1. Explain that keyword: null (or keyword: with no value) removes the keyword
    2. Clarify that this is different from empty values like '' or []
    3. Provide examples of common use cases (especially with extends and components)
  2. Add test coverage to ensure this behavior is consistent:
    1. Verify which keywords support null values
    2. Test that null properly removes inherited values
    3. Ensure validation doesn't treat null and empty values the same
  3. 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 🤖