Sobes.tech
Senior

How to make the deployment to prod run only manually in GitLab CI?

sobes.tech AI

Answer from AI

In GitLab CI, to make deployment to production run only manually, you need to use the keyword when: manual in the job description. Example configuration:

deploy_prod:
  stage: deploy
  script:
    - echo "Deploying to production..."
    - ./deploy_script.sh
  when: manual
  only:
    - main

This means that the deploy_prod job will not run automatically, and a "Play" button will appear in the GitLab interface, with deployment starting only after manual initiation.