Automated Rollback on Deployment Failure with Values File Restoration
NVIDIA ☯️ Medium CI/CD
Beginner Mode

Start your terminal to use beginner mode.

Objective

A repository at /home/interview/deploy-repo contains a values.yaml file tracking the current Docker image tag and a deploy.sh script that simulates production deployment. When deployments fail, the team must manually revert the configuration.

Task

Complete the workflow at .github/workflows/deploy.yml that triggers on push to main. The deploy job should check out code and run ./deploy.sh. A rollback job should depend on the deploy job, run only when the deployment fails (using if: failure()), check out the code with fetch-depth: 0, restore values.yaml from the previous commit using git checkout HEAD~1 -- values.yaml, and commit the restored file as "CI Bot".

File Path

  • Workflow: /home/interview/deploy-repo/.github/workflows/deploy.yml
  • Deployment script: /home/interview/deploy-repo/deploy.sh
  • Config: /home/interview/deploy-repo/values.yaml

Terminal requires a larger screen

Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.

Linux Terminal Environment

Write and execute your solution in the terminal below.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →