- Use YAML anchors to duplicate/inherit properties.
- Use the
!reference
custom YAML tag to select keyword configuration from other job sections and reuse it in the current section.
.builds: &builds # anchor definition
- "rhel8"
- "rhel9"
- "rocky8"
- "rocky9"
- "ubuntu2204"
- "ubuntu2404"
.watch_paths: # custom tag
- builds/**/*
- scripts/**/*
- .gitlab-ci.yml
build_templates:
rules:
- if: $CI_PIPELINE_SOURCE = "merge_request_event"
changes:
compare_to: 'refs/heads/main'
paths: !reference [.watch_paths] # reference to tag
parallel:
matrix:
- BUILD: *builds # anchor invokation
script:
- /bin/build.sh $BUILD
Refs:
Related: