Interview Prep/CI/CD/GitHub Actions

Developers want ephemeral preview environments for each PR, destroyed on close.

AdvancedScenarioGitHub Actions
Answer

Situation read → Per-PR environments with lifecycle.

What I'd do →

  1. On pull_request (opened, synchronize) deploy to namespace pr-${{ github.event.number }} using Helm with a unique host name and post the URL as a PR comment.
  2. On pull_request: types: [closed] run helm uninstall and delete the namespace.
  3. Add a nightly cleanup of namespaces older than N days as a safety net, plus resource quotas.

Why → Previews shorten review cycles, but orphaned environments cost money without the cleanup job.

Interview tip → The safety-net sweeper is what distinguishes a production-grade design.

All CI/CD questions

More on GitHub Actions