DevOps / Gitlab Interview questions
Why should you use GitLab environments to track deployments?
Without environments, a deploy job is just another pipeline job whose success or failure disappears into the pipeline log. Defining an environment: on that job turns it into something GitLab actively tracks over time: what's currently deployed where, the full deployment history for that target, and a direct link from a merge request to exactly what environment its changes went to.
Practically, this unlocks a few things that plain pipeline logs can't give you: a visual environments dashboard showing the last deployment per environment (staging, production, review apps), one-click rollback to a previous successful deployment, and automatic cleanup of temporary environments, like per-merge-request review apps, once the MR closes.
It also feeds GitLab's deployment approval and deployment freeze features on higher tiers, letting a team require manual sign-off before a job can deploy to production specifically, which wouldn't be possible to target if "production" were just a shell command inside an untracked job.
More Related questions...