Lesson 2 · Unit 04
Continuous delivery
One artefact, environments and secrets, rolling, blue-green and canary releases, and rollback
What you practise
- Build once and promote the artefact, environments, secrets in a pipeline, rolling, blue-green and canary releases, rolling back
Try a question from this lesson
Pick one
CI builds a commit, tests the build, and all is green. The deploy script then checks out that commit on the production server and builds it again. What is the risk?
Correct answer
The second build can differ, so untested code ships
Why
A build depends on more than the commit: the compiler on that machine, a dependency range resolved on another day. The tests vouched for the first build only. Ship the thing that was tested.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Build once, promote
Build once. The result is an artefact: a bundle, a package or a container image, labelled with the commit it came from.
That same artefact is promoted from stage to stage: tests, staging, production. What reaches users is byte for byte what was tested.
Anything that must differ between stages stays outside the artefact.
Concept
Secrets
A deploy needs credentials. They never go into the repository or the artefact.
A CI system stores secrets: encrypted values that a job receives by name at run time, and that the log viewer masks when they are printed.
Give each secret the least power the job needs, and hand deploy secrets to the deploy job only.
Concept
Rollback
A rollback puts the previous artefact back. It is quick only if you kept that artefact: redeploy it, do not rebuild it.
Decide in advance what triggers one: a failed health check, an error rate above a threshold.
The hard part is data. Code rolls back; a changed database does not.
9 more exercises in the app
- 4× multiple choice
- 1× fill the blanks
- 1× match the pairs
- 2× type the answer
- 1× order the lines
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.