# Merge keys. `<<` is a YAML 1.1 type (tag:yaml.org,2002:merge) that YAML 1.2 dropped from the
# core schema. A 1.1 loader merges the aliased mapping into the current one; a strict 1.2 loader
# treats `<<` as an ordinary key whose value happens to be an alias, so the merge never happens
# and every job silently loses its inherited settings.
#
# Precedence: keys written in the mapping itself WIN over merged keys, and in a merge sequence
# the EARLIER alias wins over later ones.
.defaults: &defaults
  image: registry.example.invalid/ci/runner:1.4
  retries: 2
  timeout: 30

.linux: &linux
  os: linux
  arch: amd64
  timeout: 600

build:
  <<: *defaults
  script: make build

test:
  <<: [*defaults, *linux]
  retries: 5
  script: make test

deploy:
  <<: *defaults
  timeout: 900
  script: make deploy

expected:
  build_timeout: 30
  test_timeout: 30
  test_retries: 5
  test_os: linux
  deploy_timeout: 900
