14/10/2025

gitlab-ci : insert code (anchors)

Tek örnek yeterli 🙂

ancak Anchor ve reference ayni yaml icinde olmak zorunda.

# Global variables available everywhere
.variables:global: &global-vars
  variables:
    COMPANY_NAME: "MyCompany"
    PROJECT_SLUG: "my-project"
    LOG_LEVEL: "INFO"

# Branch-specific variable groups that INCLUDE global vars
.variables:dev: &dev-vars
  variables:
    <<: *global-vars
    DOCKER_REGISTRY: "dev-registry.example.com"
    DOCKER_TAG: "latest-dev"
    ENVIRONMENT: "development"