What are GitLab environments and how do deployments get tracked?

IntermediateConceptGitLab CI
Answer

A job with the environment: keyword creates or updates an environment, recording each deployment with its commit and URL. You get deployment history, one-click rollback (re-run an older deployment job), and optional protected environments requiring approvals. Dynamic environments (review apps) use environment: name: review/$CI_COMMIT_REF_SLUG with an on_stop job to tear them down.

deploy-prod:
  stage: deploy
  script: ./deploy.sh
  environment:
    name: production
    url: https://app.example.com
  when: manual
All CI/CD questions Roadmap: GitLab CI/CD

More on GitLab CI