Field Notes: Bringing DevOps to a Team
Practical advice for the first months of DevOps work in a real team, grouped by the mistake it prevents. The details live in the later courses; these notes are about where to start and what to avoid.
Measure before you change anything
- Write down the current release process as it really happens, step by step, with who does each step and how long each one waits. The written process ("we deploy with the pipeline") and the real one ("then Sam SSHes in and restarts the workers") are rarely the same. The Mini Project is this exercise.
- Collect the four DORA keys from data you already have (Git, the CI system, the incident tracker), even roughly (DORA Metrics). Without a baseline, nobody can tell whether the next six months helped.
- Ask the people who deploy what they fear. The step everyone dreads is usually the right first target.
Automate the most painful step first
- Pick one manual step that is frequent, slow or error-prone, automate it completely, and make the automation the only way to do it. A script that is "optional" is soon out of date.
- Don't start with Kubernetes. A team that deploys by hand once a month gains far more from a pipeline that builds, tests and deploys to its existing servers than from a cluster nobody knows how to run.
- Put each automation in Git, with a README. An automation that lives on one engineer's laptop is a single point of failure with a holiday schedule.
Keep the pipeline fast and trustworthy
- Aim for under 10 minutes from push to a result. Past that, people stop waiting and start batching changes, which undoes everything in The Three Ways. Cache dependencies, run jobs in parallel and move slow suites to a later stage.
- Treat flaky tests as bugs, with an owner and a deadline. Flakiness compounds: the chance that a whole suite passes is the product of every test passing. A test that fails 1 in 200 runs for no reason looks harmless until there are many of them:
python · try it yourself
for flaky_tests in (1, 10, 50, 100):
for flake_rate in (0.005, 0.01):
green = (1 - flake_rate) ** flaky_tests
print(f"{flaky_tests:>3} flaky tests at {flake_rate:.1%} each -> "
f"{1 - green:5.1%} of pipeline runs fail for no reason") 1 flaky tests at 0.5% each -> 0.5% of pipeline runs fail for no reason
1 flaky tests at 1.0% each -> 1.0% of pipeline runs fail for no reason
10 flaky tests at 0.5% each -> 4.9% of pipeline runs fail for no reason
10 flaky tests at 1.0% each -> 9.6% of pipeline runs fail for no reason
50 flaky tests at 0.5% each -> 22.2% of pipeline runs fail for no reason
50 flaky tests at 1.0% each -> 39.5% of pipeline runs fail for no reason
100 flaky tests at 0.5% each -> 39.4% of pipeline runs fail for no reason
100 flaky tests at 1.0% each -> 63.4% of pipeline runs fail for no reason
Once a third of runs fail randomly, people press "re-run" by reflex, and real failures get re-run too. Quarantine flaky tests in a separate non-blocking job and fix them from there.
- Pin versions of base images, CI actions (by commit SHA) and tools, and let a bot (Dependabot, Renovate) propose updates. "It broke overnight and nobody changed anything" is almost always an unpinned dependency.
- Build once, promote the same artifact. Staging and production run the same image digest. Rebuilding for production means production runs something nobody tested.
Make change safe instead of rare
- Rehearse the rollback before you need it: deploy the previous version on purpose in staging, then in production during a quiet hour. A rollback path that has never been used is a hope, not a plan.
- Separate deploy from release with feature flags, so a risky feature can be turned off without a deployment (Feature Flags).
- Ship database migrations in backward-compatible steps (expand, migrate, contract), so the old and new versions of the app can run side by side during a rolling update and after a rollback.
- Freeze periods are a symptom. If the team cannot deploy safely in December, it cannot deploy safely in June either; it just notices less.
Operate what you ship
- Alert on symptoms users feel (error rate, latency, failed checkouts), not on every high CPU graph. Every alert that wakes someone must need a human action now; everything else goes to a dashboard or a ticket.
- Write the runbook during the incident's postmortem, while the steps are fresh, and link it from the alert.
- Track postmortem action items like features, with owners and dates. A postmortem whose actions are never done is a story, not a learning.
- Watch expiry dates: TLS certificates, domain names, API tokens, cloud credits. Each one has caused famous outages. Monitor them and alert weeks ahead.
Work with people, not around them
- Make the right way the easy way. A pipeline template, a starter repository or a
make deploythat does the correct thing gets adopted; a wiki page of rules does not. - Pair with developers on their first pipeline or dashboard instead of building it for them. The goal is a team that runs its own service (You Build It, You Run It).
- Write things down. Decisions, diagrams and runbooks in the repository outlive meetings and people.
Test yourself
A suite has 50 tests that each fail randomly 1% of the time. Roughly how often does the pipeline fail for no reason?
- About 1% of runs
- About 5% of runs
- About 40% of runs
- Never
Why should staging and production run the same image digest?
- It saves registry space
- Rebuilding for production means running an artifact that was never tested
- Kubernetes requires it
- Digests are shorter than tags
A team deploys by hand once a month. What is usually the best first DevOps investment?
- Migrate to Kubernetes
- Automate the build, test and deploy to the existing servers with a pipeline
- Buy an observability platform
- Introduce a change freeze