Ravindra BagaleCourses & study guides मराठी

Chapter 16: Capstone — Ship It End-to-End

DevOps

16.12e Honesty over theatre

Why: the problem

Picture two capstone demos. One shows a perfect slide deck, and nothing runs. The other says: "CI is green, deploy works, rollback works. Autoscaling is not done; here is why." Companies like GitLab publish their outage reports openly, because honest status builds trust. In this lesson you produce a STATUS.md automatically, so it can never claim more than the checks prove.

What we will build

ops/status.sh runs each check and writes ✅ or ❌ into STATUS.md. Next, a KNOWN-ISSUES.md template. Last, a Python guard that fails CI if the README claims a feature that STATUS.md shows as ❌.

What: every term in plain English

  • Status report — A list of what works and what does not, right now.
  • Known issue — A problem you know about and have written down.
  • Claim — A sentence in docs saying a feature works.
Generate status Check claims Fix README Recheck

How: step by step

  1. Generate status

    ops/status.sh
    

    What it does: Runs checks; writes STATUS.md.

    Output

    ✅ unit tests
    ✅ acceptance
    ✅ rollback
    ❌ autoscaling
    wrote STATUS.md
    
  2. Check claims

    python3 ops/claims_guard.py
    

    What it does: Compares README with STATUS.

    Output

    README claims "autoscaling" but STATUS says ❌
    exit 1
    
  3. Fix README

    nano README.md
    

    What it does: Change the claim to "planned".

    Output

    (no output)
    
  4. Recheck

    python3 ops/claims_guard.py
    

    What it does: Now honest.

    Output

    claims match status ✔
    

Example 1: Status from real checks

Stack. Bash

Goal. Status from real checks.

ops/status.sh

#!/usr/bin/env bash
# ops/status.sh — write STATUS.md from real checks only
set -u
out=STATUS.md; echo "# Status $(date '+%F %H:%M')" > "$out"
row() {  # row <name> <command...>
  local name=$1; shift
  if "$@" >/dev/null 2>&1; then m="✅"; else m="❌"; fi
  echo "$m $name"; echo "- $m $name" >> "$out"
}
row "unit tests"  bash -c "cd app && npm test"
row "acceptance"  env BASE_URL=http://localhost:3000 tests/acceptance.sh
row "rollback"    test -x ops/rollback.sh
row "autoscaling" kubectl get hpa badge-api
echo "wrote $out"

What each line does

  • row() { ... "$@" ... } — Runs any command; ✅ if exit 0, ❌ otherwise.
  • shift — Removes the name so "$@" is only the command.
  • kubectl get hpa — Checks a HorizontalPodAutoscaler really exists.

Green output

✅ unit tests
✅ acceptance
✅ rollback
❌ autoscaling
wrote STATUS.md

Expected result. Status cannot lie; it comes from exit codes.

Example 2: Fail CI when the README claims too much

Stack. Python 3

Goal. Fail CI when the README claims too much.

ops/claims_guard.py

import re
import sys

status = open("STATUS.md").read()
readme = open("README.md").read().lower()
bad = []
for mark, name in re.findall(r"- (✅|❌) (.+)", status):
    said = re.search(rf"\b{re.escape(name.lower())}\b(?!.*planned)", readme)
    if mark == "❌" and said:
        bad.append(name)
for name in bad:
    print(f'README claims "{name}" but STATUS says ❌')
if bad:
    sys.exit(1)
print("claims match status ✔")

What each line does

  • re.findall(r"- (✅|❌) (.+)") — Reads each status line.
  • (?!.*planned) — Mentions with "planned" on the same line are allowed.
  • sys.exit(1) — Fails CI.

Green output

README claims "autoscaling" but STATUS says ❌

Expected result. Docs stay honest automatically.

Example 3: A known-issues file with a clear format

Stack. Markdown

Goal. A known-issues file with a clear format.

KNOWN-ISSUES.md

# Known issues
| ID | What | Impact | Workaround | Plan |
|---|---|---|---|---|
| KI-1 | No autoscaling | Spikes above ~200 rps slow down | Scale manually: kubectl scale deploy/badge-api --replicas=4 | Add HPA in v2 |
| KI-2 | Single region | Region outage = downtime | Redeploy with Terraform in another region (~15 min) | Multi-region later |
| KI-3 | No HTTPS on lab EC2 | Traffic not encrypted | Lab only, IP-restricted | Add ALB + ACM cert |

What each line does

  • Impact — What the user feels.
  • Workaround — What to do today.
  • Plan — When it will be fixed.

Green output

$ cat KNOWN-ISSUES.md   (table above)

Expected result. Gaps written down look professional, not weak.

Example 4: Compare README claims with real checks

Stack. Bash

Goal. Compare README claims with real checks.

ops/claims.sh

#!/usr/bin/env bash
claim() { if grep -qi "$1" README.md; then
  if eval "$2" > /dev/null 2>&1; then echo "TRUE  $1"; else echo "FALSE $1  (remove or mark planned)"; fi; fi; }
claim "rollback"     "test -x ops/rollback.sh"
claim "kubernetes"   "kubectl get deploy badge-api"
claim "monitoring"   "curl -fs localhost:9090/-/ready"
claim "autoscaling"  "kubectl get hpa badge-api"

What each line does

  • claim() — Only checks words that appear in README.
  • FALSE — The README promises something that does not run.

Green output

TRUE  rollback
TRUE  kubernetes
FALSE monitoring  (remove or mark planned)

Expected result. Fix the README: "Monitoring (planned for v2)". Honest and still impressive.

Example 5: A known issues table that shows maturity

Stack. Markdown

Goal. A known issues table that shows maturity.

docs/KNOWN-ISSUES.md

| Issue | Impact | Workaround | Plan |
|---|---|---|---|
| No HTTPS on the VM | Lab only, not for real users | Use kind port-forward | Add Traefik in v2 |
| One replica on VM | Downtime during deploy (about 3s) | Deploy at low traffic | Path B has 2 replicas |

What each line does

  • Impact — Who is affected and how much.
  • Plan — Shows you know the next step.

Green output

(rendered as a table in the repo)

Expected result. Interviewers trust people who list their gaps clearly.

Example 6: Say it honestly in the demo

Stack. Communication

Goal. Say it honestly in the demo.

script.txt

"Rollback is tested; here is the output from today.
Monitoring is not done yet. I listed it in known issues with a plan.
If I had two more days, I would add Prometheus and one alert."

What each line does

  • Tested + output — Proof first.
  • Not done yet — No pretending.
  • Two more days — Shows planning skill.

Green output

(spoken, about 20 seconds)

Expected result. This answer scores better than a demo that hides a broken part.

Example 7: Fail CI when the README makes a false claim

Stack. GitLab CI

Goal. Fail CI when the README makes a false claim.

.gitlab-ci.yml part

claims:
  stage: verify
  script:
    - bash ops/claims.sh | tee claims.txt
    - "! grep -q FALSE claims.txt"

What each line does

  • tee — Show and save the output.
  • ! grep -q FALSE — Fails the job when any claim is false.

Green output

TRUE  rollback
TRUE  kubernetes
Job succeeded

Expected result. The README can never promise more than the system does.

Example 8: Write the status from checks, not from memory

Stack. Bash

Goal. Write the status from checks, not from memory.

ops/status_md.sh

#!/usr/bin/env bash
row() { if eval "$2" > /dev/null 2>&1; then echo "| $1 | done |"; else echo "| $1 | not yet |"; fi; }
{ echo "| Feature | Status |"; echo "|---|---|"
  row "Tests"     "cd app && npm test --silent"
  row "Rollback"  "test -x ops/rollback.sh"
  row "Alerts"    "test -f deploy/alerts.yml"; } > STATUS.md
cat STATUS.md

What each line does

  • row() — One table row per check.
  • not yet — Honest wording.

Green output

| Feature | Status |
|---|---|
| Tests | done |
| Rollback | done |
| Alerts | not yet |

Expected result. The table is always true because a script wrote it.

Verify: did it work?

  1. Guard in CI

    python3 ops/claims_guard.py; echo exit=$?
    

    What it does: 0 means honest.

    Output

    claims match status ✔
    exit=0
    

When it is red 1

FileNotFoundError: STATUS.md

Cause. status.sh was not run.

Fix, step by step

  1. ops/status.sh
  2. Then rerun the guard.

When it is red 2

❌ acceptance even though the app runs

Cause. App is on a different port.

Fix, step by step

  1. curl localhost:3000/health
  2. Fix BASE_URL in status.sh.

When it is red 3

FALSE kubernetes

Cause. Cluster is stopped or the Deployment name differs.

Fix, step by step

  1. kubectl get deploy -A
  2. Fix the README or start the cluster.

When it is red 4

bash: ops/claims.sh: Permission denied

Cause. Script is not executable.

Fix, step by step

  1. chmod 755 ops/claims.sh

Cleanup

  1. Remove generated status

    rm -f STATUS.md
    

    What it does: Regenerate before each demo.

    Output

    (no output)
    

Ravindra Bagale's Tip

Show what works, say what does not. Interviewers like honesty.

Practice tasks

Easy status

Why: Doing it once with your own hands makes it stick.

What to do: Run status.sh.

How:
  1. ops/status.sh

Check: STATUS.md.

Easy Read

Why: Doing it once with your own hands makes it stick.

What to do: Read STATUS.md.

How:
  1. cat

Check: Marks shown.

Easy KI

Why: Doing it once with your own hands makes it stick.

What to do: Add one known issue.

How:
  1. Edit KNOWN-ISSUES.md

Check: Row added.

Easy Guard

Why: Doing it once with your own hands makes it stick.

What to do: Run claims_guard.

How:
  1. python3 ...

Check: Result prints.

Medium False claim

Why: Doing it once with your own hands makes it stick.

What to do: Add "autoscaling" to README.

How:
  1. Edit, run guard

Check: exit 1.

Medium Fix wording

Why: Doing it once with your own hands makes it stick.

What to do: Change to "autoscaling (planned)".

How:
  1. Run guard

Check: ✔.

Medium New row

Why: Doing it once with your own hands makes it stick.

What to do: Add "evidence pack" status row.

How:
  1. row ... test -d evidence

Check: ✅.

Medium CI

Why: Doing it once with your own hands makes it stick.

What to do: Run guard in CI.

How:
  1. Add a step.

Check: Blocks bad PR.

Hard HPA

Why: Doing it once with your own hands makes it stick.

What to do: Create an HPA in kind.

How:
  1. kubectl autoscale deploy badge-api --min=1 --max=3 --cpu-percent=70

Check: ✅ autoscaling.

Hard Date check

Why: Doing it once with your own hands makes it stick.

What to do: Fail if STATUS.md older than 1 day.

How:
  1. find -mtime +0

Check: Stale fails.

Homework: try at home

Try at home

Run status.sh, then write one KNOWN-ISSUES row for every ❌. Present it to a friend in 2 minutes.

Recap

  • Status comes from checks.
  • A guard keeps docs honest.
  • Write known issues with impact and plan.
  • Honesty builds trust.

FAQ

Will gaps hurt my grade?

Hidden gaps hurt more.

Is the regex perfect?

No; it catches common cases.

Should STATUS be committed?

Yes, at demo time.

How many known issues is too many?

None if they are honest and planned.

Can I use GitHub Issues instead?

Yes; link them.

Will listing gaps make me look weak?

No. Clear gaps with a plan look senior.

What if a recruiter asks about a missing feature?

Say it is planned, show the known issues table.

Is "planned" just an excuse?

Not if it has a date and a first step.

Is it okay to say "I do not know"?

Yes, then say how you would find out.

Interview questions

  1. How do you report project status?

    From measurable checks, with known issues listed.

  2. Tell me about a failure.

    Say what broke, impact, fix, and what you changed.

  3. What is a blameless postmortem?

    A review focused on systems, not people.

  4. How do you avoid overpromising?

    Tie claims to tests.

  5. What goes in a known issue?

    What, impact, workaround, plan.

Quick quiz

Q1. Where does STATUS come from?

Real check exit codes.

Q2. What does the guard stop?

Claims beyond proof.

Q3. Is a known issue bad?

No; hiding it is.

Q4. What three fields matter?

Impact, workaround, plan.

Q5. Why "planned"?

Allowed honest wording.

Lab

Complete the Ship-It capstone on your machines/accounts.

  1. Create the repo layout; implement /health + /badge.
  2. Dockerfile + Compose green locally.
  3. GitHub Actions: PR tests + main image push with SHA tag.
  4. Finish deploy path A or B; curl health.
  5. Write RUNBOOK + tick CHECKLIST; cleanup the same day.

Thodkyaat sangaycha tar

  • Capstone = one shippable story: badge API (or Netflix-style tiny service) → image → CI → deploy → health → rollback → cleanup.
  • One deploy path fully done beats two half paths.
  • Runbook is interview gold; secrets never in Git; cleanup same day.
  • Optional Infosys-style handoff: README clear enough for someone else.

Did you understand? Let us try it once more.

Ravi Sir's Cards for this lesson

मराठी cards