Interview Prep/Jenkins/Integrations & delivery

You need to run end-to-end tests against an ephemeral environment per PR and clean it up reliably. Design it.

AdvancedScenarioIntegrations & delivery
Answer

Situation read → Preview environments tied to PR lifecycle.

What I'd do →

  1. On PR build: create namespace pr-${CHANGE_ID}, deploy with Helm using the PR image tag, run E2E tests.
  2. In post { cleanup { } }: optional teardown; better to keep the environment while the PR is open.
  3. A scheduled cleanup job deletes namespaces whose PR is closed (query GitHub API) or older than N days; label namespaces with pr, created-at.
  4. ResourceQuota per preview namespace.

Why → post cleanup is not enough (aborted builds, controller restarts), so a reaper job is essential.

Interview tip → Mention cost controls on preview environments.

All Jenkins questions Roadmap: Jenkins

More on Integrations & delivery