Secrets: deploy jobs need a database password, and it must not leak from MR pipelines.
IntermediateScenarioGitLab CI
Answer
Situation read → CI/CD variables scoping.
What I'd do →
- Add the variable as masked, hidden, and protected, scoped to environment
production. - Protected variables are only exposed to pipelines on protected branches/tags.
- Prefer external secrets: Vault via
secrets:keyword withid_tokens(OIDC JWT) instead of storing the value.
Why → MR pipelines from unprotected branches cannot read protected variables.
Interview tip → Masking requires value rules (length, characters); mention that limitation.
More on GitLab CI
How does GitLab CI/CD work at a high level?BeginnerWhat is a GitLab Runner and what executors exist?IntermediateWhat are the types of runners (shared, group, project) and tags?IntermediateHow do `rules:` work and how do they replace `only/except`?IntermediateWhat are workflow rules and how do they prevent duplicate pipelines?AdvancedHow do artifacts and cache differ in GitLab CI?Intermediate