Sign inSign up free

817. Promote an Image Between Environments

medium 20 XP ~12 minHands-on lab

/home/student/repos/storefront/envs/ holds one KEY=VALUE file per environment: dev.env, staging.env, production.env. A release moves the tested image forward with scripts/promote.sh FROM TO, run from the repository root.

Today it failed with sed: -e expression #1: unknown option to 's'. Earlier it set IMAGE_PULL_POLICY to an image name, and once it promoted a build that had never been verified.

Task

Fix scripts/promote.sh FROM TO so that:

  • only dev → staging and staging → production are allowed; anything else fails,
  • it refuses (fails) unless FROM has VERIFIED=true,
  • it sets the IMAGE= line of TO to the IMAGE of FROM, and VERIFIED=false in TO (the new image there still needs testing),
  • every other line of TO stays exactly as it was, in the same order, comments included; FROM isn't changed,
  • on success it prints promoted <image> to <TO>.

When it fails, no file may change.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of CI/CD Pipelines in Practice. Next step: Roll Back to the Right Release

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.