Promote or rebuild
There are two ways to deliver a container image to production:
| Promote | Rebuild | |
|---|---|---|
| How | The image built and tested in staging is deployed to production as is | Production gets a new image, built again from the code |
| What runs in production | Exactly what was tested | Something very similar to what was tested |
Why promoting is safer
Section titled “Why promoting is safer”A rebuild is not guaranteed to produce the same image. Between the two builds, a base image tag may have moved, a dependency may have released a new version, a build tool may have changed. The image in production may then contain packages, and vulnerabilities, that nobody tested.
Promoting keeps the principle of build once, deploy many: the image is identified by its digest, and the same digest goes from staging to production. What was tested, scanned and approved is what runs.
When rebuilding happens
Section titled “When rebuilding happens”Rebuilding is common when each environment has its own branch, or when configuration is baked into the image. If you rebuild, scan the production image itself, not only the staging one.
What it means for vulnerabilities
Section titled “What it means for vulnerabilities”The question “what vulnerabilities are in production?” has a different answer depending on the model:
- Promote: production has the vulnerabilities of the staging image that was promoted.
- Rebuild: production has the vulnerabilities of its own build, which may differ.
In Leavory
Section titled “In Leavory”In Settings, you tell the Workspace which branches are development, staging and production, and whether production promotes or rebuilds. The Dashboard and Findings then show the vulnerabilities of each environment based on what really runs there.