use unified requirements image which is local-shared-friendly#30
Merged
matt-codecov merged 3 commits intomainfrom Apr 9, 2025
Merged
use unified requirements image which is local-shared-friendly#30matt-codecov merged 3 commits intomainfrom
matt-codecov merged 3 commits intomainfrom
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
Swatinem
approved these changes
Apr 8, 2025
47cf38d to
c3b1ad7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.