Production deploy needs manual trigger and the environment must show up in GitLab's Environments page.
BeginnerScenarioGitLab CI
Answer
Situation read → Manual gated deploy with environment tracking.
What I'd do →
deploy_prod:
stage: deploy
script: ./deploy.sh prod
environment:
name: production
url: https://app.example.com
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
Protect the production environment so only certain roles can deploy.
Why → Protected environments enforce who may run the manual job.
Interview tip → Mention allow_failure: false on manual jobs to block the pipeline until it is run.
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