refactor: make devctr build process multi-staged.#5779
refactor: make devctr build process multi-staged.#5779JamesC1305 wants to merge 8 commits intofirecracker-microvm:mainfrom
Conversation
8633fcd to
5bb3b57
Compare
5bb3b57 to
d802498
Compare
Update the rust toolchain to version 1.94.0. This will close dependabot PR firecracker-microvm#5803. Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
Update python dependencies to close dependabot PRs: - filelock firecracker-microvm#5626 - black firecracker-microvm#5756 - requests firecracker-microvm#5798 - pygments firecracker-microvm#5804 Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
Switch from a single stage build to a multi-staged build for the devctr.
Although we don't often rebuild this, this should reduce the time taken
when we do, due to unchanged layers now being cached.
In my testing, this cut the full build time from ~1300s to ~600s without
inflating the image size further. We also don't have to manually clean
up after earlier build stages, as they are not included in the final
image.
Stage dependency graph:
+--- qemu-builder -------+
| |
+--- libseccomp-builder -+
| |
base-image +--------------------+--- iperf3-builder -----+--- devctr
| | |
| +--- git-secrets-builder +
| |
+--- apt-base |
| |
| |
python-deps +--- crosvm-builder -----+
| | |
rust-toolchain ---+------------------------+
Parallel builders (from base-image):
qemu-builder, libseccomp-builder, iperf3-builder, git-secrets-builder
Sequential base chain:
base-image -> apt-base -> python-deps -> rust-toolchain
Rust fork (from rust-toolchain):
crosvm-builder (build deps thrown away, only binary copied)
devctr (cargo tools, kani, nightly, then COPY
from all builders)
Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
With the latest devctr dependency updates, running `tools/devtool fmt` results in some files being reformatted. These are resulting from new versions of `black` and `mdformat`. Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
As of rust toolchain version 1.94.0, CPUID-related functions from the standard library are no longer unsafe [1]. However, we cannot simply remove them as the nightly toolchain used by Kani has not been updated to a version with this change. Add TODO comments to remove unsafe blocks when Kani toolchain is updated. [1]: rust-lang/stdarch#1935 Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
d802498 to
ceb25ce
Compare
zulinx86
left a comment
There was a problem hiding this comment.
LGTM. Let me know when you bumped the tag.
Update the devctr to the latest tag v89 Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5779 +/- ##
=======================================
Coverage 83.04% 83.04%
=======================================
Files 276 276
Lines 29466 29466
=======================================
Hits 24471 24471
Misses 4995 4995
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The LTS ubuntu 24.04 version seems to have been updated since the last devctr build. Update the get_os_version() function accordingly. Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
Manciukic
left a comment
There was a problem hiding this comment.
there's 2 fewer dependencies in the final image. Are they used at runtime during the vhost-user tests?
| RUN apt-get update \ | ||
| && apt-get -y install --no-install-recommends \ | ||
| # essential build tools | ||
| gcc make libc-dev binutils-dev libssl-dev \ |
There was a problem hiding this comment.
libcap2 looks like a runtime dependency for running vhost-user tests. libglib2.0-dev looks like a build dependency but maybe it's pulling in the runtime dependency as well so we should double check
There was a problem hiding this comment.
All the tests in test_drive_vhost_user.py seem to be passing. I checked the installed packages in the devctr and it seems like libcap2 is already installed, so it must be dragged in by something else. Perhaps we should just make it explicit then.
Make the devctr build process multi-staged. This decouples the different build processes from each other, and in my measurement cut the build time from ~1300s to ~600s (21min to 8min).
In this PR we also update the poetry dependencies and rust toolchain to 1.94.0.
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.PR Checklist
tools/devtool checkbuild --allto verify that the PR passesbuild checks on all supported architectures.
tools/devtool checkstyleto verify that the PR passes theautomated style checks.
how they are solving the problem in a clear and encompassing way.
in the PR.
CHANGELOG.md.Runbook for Firecracker API changes.
integration tests.
TODO.rust-vmm.