-
Notifications
You must be signed in to change notification settings - Fork 11
use unified requirements image which is local-shared-friendly #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
74d1ede to
d17ca70
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #30 +/- ##
=======================================
Coverage 96.49% 96.50%
=======================================
Files 1654 1644 -10
Lines 93104 93023 -81
Branches 1464 1464
=======================================
- Hits 89843 89771 -72
+ Misses 2956 2947 -9
Partials 305 305
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. 📢 Thoughts on this report? Let us know! |
CodSpeed Performance ReportMerging #30 will not alter performanceComparing Summary
|
d17ca70 to
47cf38d
Compare
47cf38d to
c3b1ad7
Compare
this PR does three things:
Dockerfile.requirementsMakefiletargets to build images with saidDockerfile.requirementsMakefiletargets rather thancd-ing toapps/workeretc firstrelated:
background
as part of cutover, we want to make worker/api use the copy of shared from inside the repository rather than a specific hardcoded SHA that it fetches from GitHub. conceptually it's as simple as replacing
shared = { sha = "abcdef1234567890" }withshared = { path = "../../libs/shared" }inpyproject.toml, but there are a few complications:docker buildcan only access things in its working directory. no..s. so we must run it from the repository root, notapps/workerorapps/codecov-apiwhich is how we were building images beforesharedis still a dependency that worker/api need to install, but changes to it are no longer reflected inpyproject.tomloruv.locksince we're not hardcoding a specific SHA anymore. changing shared thus won't change the requirements image tag or cache keys like we need. so we need a way to reflect changes to shared in those thingsto solve these problems, i changed how umbrella builds containers and runs CI in three ways:
unified
Dockerfile.requirementsas explained above, we need to build the requirements images from umbrella rather than worker/api's subdirectories. the worker/api
Dockerfile.requirementsfiles are almost identical, so i basically merged them to create a unifiedDockerfile.requirements.although the actual
Dockerfile.requirementsis shared, worker/api still have separate requirements images. the unified dockerfile takes anAPP_DIRbuild argument (apps/workerorapps/codecov-api) and will use thepyproject.toml/uv.lockfrom inside that directory to build the image. if/when we move to a repo-wide python project, we can pass.in instead to move to a shared requirements image.one difference between the unified requirements image and the versions in
apps/workerandapps/codecov-apiis that this one bind-mountslibs/sharedinside the container. currently this doesn't matter, but after cutover this is what will allowshared = { path = "../../libs/shared" }to work.Makefiletargetsthis PR adds
worker.*,api.*, andshared.*targets to umbrella'sMakefile. by default, anyworker.*target will set some variables to worker/umbrella-appropriate values and then shell out to worker'sMakefile, but we override the targets used to build requirements images so we can use the umbrella version explained above.it also changes how we calculate
REQUIREMENTS_TAGin two ways:Dockerfile.requirementsinstead of the worker/api-specific oneslibs/shared. any commit that toucheslibs/sharedwill trigger a rebuild that installssharedwith those changes.git archive --format=tar HEAD libs/shared | sha1sum | head -c 40which is actually very fastsharedas an actual package, we can just get rid of this logic entirely(after cutover, we can probably eliminate the hard-to-read variable override functions and pattern rules)
CI change
this PR moves from the old
working_directoryargument i added to a newmake_target_prefixargument i added. if a workflow is going to callmake build, umbrella can use this argument to turn that intomake worker.buildwhich will run the specialMakefiletargets explained aboveunfortunately, i couldn't totally get rid of
working_directory. because of the way things work, things likejunit.xmlorapp.tarare still dumped inapps/workeretc. so i renamed the argumentoutput_directorythis PR also uses the new
reqs_cache_keyargument to supply a cache key for the requirements image that properly accounts for changes tolibs/shared. the way this is done is messy, but it can be cleaned up after cutover when we can just replace the old way of computing the cache key.