Product wants a Slack notification whenever a deploy finishes. You have 30 minutes. What do you build?
BeginnerScenarioAutomation scripting & CLI design
Answer
Situation read → Small, well-scoped integration; the risk is leaking the webhook URL or blocking the deploy on Slack.
What I'd do →
- Create a Slack incoming webhook; store the URL as a CI secret.
- Add a tiny script or step:
import os, requests
resp = requests.post(os.environ["SLACK_WEBHOOK_URL"],
json={"text": f":rocket: {os.environ['SERVICE']} {os.environ['VERSION']} deployed to prod"},
timeout=5)
resp.raise_for_status()
- Run it with
if: always()and report success or failure; make the notify step non-blocking (continue-on-error: true).
Why → A notification must never fail a successful deploy.
Interview tip → Mention keeping the webhook URL secret; it is a credential.
More on Automation scripting & CLI design
Your team has a 300-line Bash script that parses JSON with `jq`, loops over AWS accounts and retries with `sleep`. It breaks every month. Do you rewrite it in Python?BeginnerA colleague's script deletes files older than 30 days from `/var/log/app`. You are asked to review it before it goes into cron. What do you look for?IntermediateYou need a script that ops engineers run from laptops and that CI runs nightly. How do you design its interface?IntermediateA script reads a 15 GB access log to count 5xx errors per endpoint, and the box runs out of memory. How do you fix it?BeginnerYou must run the same Python automation on 40 servers that have Python 3.6, 3.9 and 3.12. What do you do?IntermediateA cron job that runs a Python script fails silently. Nobody noticed for two weeks. How do you make sure that never happens again?Intermediate