Cloud / DevOps Engineer · Projects

Project 2: A pipeline with a way back

Marking guide version 1 · Lessons: CD1 lesson 5, CD7 lessons 1–5, CD8 lessons 1–4, CD10 lesson 3

The problem and who it's for

RouteRani's workflow deploys from any branch, with a token that can do anything, actions that change without warning, and a step that prints a secret. The deploy script accepts any version, never runs the tests and has no way back: a bad release stays live until someone notices. On a Friday evening, when bookings for the weekend peak, a release that fails a quarter of requests would cost hundreds of bookings.

Scope

Not included

Before you start

Starter files

Download everything at once: starter/cloud-devops-starter.zip.

Milestones

  1. Run npm run test:pipeline and note which of the 10 tests fail and why.
  2. Fix the workflow's triggers, permissions, pinning and secret step (tests 1 to 3).
  3. Add needs, the main condition, the environment and concurrency (test 4).
  4. Add the version check and the test stage (tests 5 and 10).
  5. Add verification and rollback, and the release_fault variable (tests 6 to 9).
  6. Run all 10 tests twice in a row, and record a deploy under load and the three practice faults.

Expected outputs

Acceptance tests

# Input Expected result
1 npm run test:pipeline 10 of 10 pass, twice in a row
2 node tools/pipeline.js latest Stops with an error before building anything (test 5)
3 node tools/pipeline.js 1.0.2 --skip-tests while tools/load.js sends traffic 1.0.2 live; at most 0.5% of requests failed (test 6)
4 node tools/pipeline.js 1.0.3 --fault=unhealthy --skip-tests Non-zero exit; 1.0.2 live; no unhealthy copies left (test 7)
5 The same with --fault=errors and --fault=slow Each rolled back by itself, with the reason in the output (tests 8 and 9)
6 A failing test added to app/test/, then node tools/pipeline.js 1.0.6 Stops before an image is built (test 10)

Failure and recovery exercises

  1. Change the verify limit from 1% to 30% and run the errors fault. Explain what happened and why the limit matters, then restore it.
  2. Read the previous version after the deploy instead of before, and run the unhealthy fault. Describe what the rollback does, then fix it.
  3. In the workflow, put ${{ github.event.pull_request.title }} inside a run: line, and explain in two sentences how an attacker could use it. Then change it to pass the title through env:.

Evidence to submit

Marking guide and self-check

Pass rule: every Safety-critical (S) and Mandatory (M) item must be met. A single unmet safety item means the project is not complete, whatever else is done. Quality items are for your own improvement.

Your answers are saved in this browser on this device. Self-checked means you checked your own work against this guide; it is not a reviewer's approval. Never paste passwords, keys, tokens or real customer data here.

Checklist (marking guide version 1)
Evidence

← PreviousAn environment from code
ProLearners Assist