Gitlab rollback

Is it possible that when a job is failing in gitlab ci cd pipeline, then can we revert the environment deployment to previous deployment?

I have below pipeline which has two jobs, first one deploys and second validates the deployment:
If verification fails then i want to revert to previous deployment? probably a new job or some command in “test” job?

stages:

  • deploy
  • test

deploy-test:
stage: deploy
script:

ui_tests:
stage: test
script:

  • ./mvnw verify -Dwebdriver.chrome.driver=/home/gitlab-runner/softwares/chromedriver
1 Like

Hi @shafqat.baig, was you able to build this?