How do `include` and `extends` help reuse configuration?

IntermediateConceptGitLab CI
Answer

include pulls in YAML from local files, other projects, remote URLs or GitLab templates. extends makes a job inherit from a hidden job (name starts with a dot), merging keys. Anchors (&/*) also work within a file.

include:
  - project: platform/ci-templates
    ref: v2.1.0
    file: /templates/docker-build.yml
  - template: Security/SAST.gitlab-ci.yml

.deploy-base:
  image: bitnami/kubectl:1.31
  before_script: [kubectl config use-context $KUBE_CONTEXT]

deploy-staging:
  extends: .deploy-base
  script: [kubectl apply -f k8s/]
All CI/CD questions Roadmap: GitLab CI/CD

More on GitLab CI