-
Notifications
You must be signed in to change notification settings - Fork 89
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
build: ensure request hash is the same as build hash #1188
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1188 +/- ##
===========================================
+ Coverage 80.75% 91.36% +10.61%
===========================================
Files 15 13 -2
Lines 977 1170 +193
===========================================
+ Hits 789 1069 +280
+ Misses 188 101 -87 ☔ View full report in Codecov by Sentry. |
Thanks, good point. Isn't something like below the "better" solution? diff --git a/asu/util.py b/asu/util.py
index 0bf1b87..8704b74 100644
--- a/asu/util.py
+++ b/asu/util.py
@@ -141,7 +141,12 @@ def get_request_hash(build_request: BuildRequest) -> str:
build_request.version_code,
build_request.target,
build_request.profile.replace(",", "_"),
- get_packages_hash(build_request.packages),
+ get_packages_hash(
+ x.removeprefix("+")
+ for x in (
+ build_request.packages_versions.keys() or build_request.packages
+ )
+ ),
get_manifest_hash(build_request.packages_versions),
str(build_request.diff_packages),
"", # build_request.filesystem |
Yeah, I like that (my first inclination was to do a least-intrusive patch). What do you think about adding that to my current patch, rather than replacing it altogether? Then we get reproducible results, plus we save the time recomputing the hash... |
How are the results more reproducible? I think the computation of the hash is negligible, I don't know what the "get current job" function does in the background. |
Reproducible in the sense that you can call Looks like I see no way of passing the actual job into build, since it's created after the call to https://github.com/rq/rq/blob/master/rq/queue.py#L965 |
23bb9e0
to
45a762e
Compare
When using 'packages_versions' the request hash that is calculated before request validation in 'api_v1_build_post' often differs from the one calculated in 'build'. This is due to 'validate_request' modifying the request's package lists. We pass the same request hash used when creating the job, thus making them consistent again. Signed-off-by: Eric Fahlgren <[email protected]>
45a762e
to
8a28caf
Compare
When using 'packages_versions' the request hash that is calculated before request validation in 'api_v1_build_post' often differs from the one calculated in 'build'. This is due to 'validate_request' modifying the request's package lists.
We extract the request hash from the job, thus making them consistent again.