Use explicit stages for predictable progression.

Section: Core stage patterns

GitLab stage ordering

yaml
yaml
stages:
  - lint
  - test
  - build
  - deploy

deploy_production:
  stage: deploy
  script:
    - ./scripts/deploy.sh
  only:
    - main
Explanation

In GitLab, jobs in later stages wait until earlier stages succeed unless you intentionally relax dependencies.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Core stage patterns
Multi-stage GitHub Actions workflow
Separate lint, test, build, and deploy into distinct jobs.
OpenIn sheetyamlsame section
Always archive reports and clean up
Preserve artifacts even when the pipeline fails.
OpenIn sheetgroovysame section
Manual production gate in GitLab
Add a human approval step before production deployment.
OpenIn sheetyaml1 tag match
Staging then production promotion
Require staging verification before production deploy.
Blue/green deploy flow
Switch traffic after health checks pass on the new environment.