-
Notifications
You must be signed in to change notification settings - Fork 54
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
Refactor to improve synchronization and testability #45
base: master
Are you sure you want to change the base?
Refactor to improve synchronization and testability #45
Commits on Jul 2, 2019
-
Pull code that creates a comment on a pull request out of the authorization check, and add tests around the authorization checks. After pulling out the code that creates a comment, we still need to know what the text of the comment will be, so change from a function that returns a True on success and a False on failure to a function that returns a True on success and raises an Exception (with the failure comment) on failure.
Configuration menu - View commit details
-
Copy full SHA for f1fd009 - Browse repository at this point
Copy the full SHA f1fd009View commit details -
Replace db_query with LockingDatabase
Remove the free function `db_query` in favor of a `LockingDatabase` class that wraps a database connection. This is done so that, in order for a class to use the database, it only needs its `db` instance, instead of needing both a `db` instance and a `db_query` function. This allows us to break out classes into separate files.
Configuration menu - View commit details
-
Copy full SHA for 6053821 - Browse repository at this point
Copy the full SHA 6053821View commit details -
Pull PullReqState into its own file
Extract PullReqState into its own file for code readability. Because PullReqState shares some constants with main and server, extract those constants into a `consts.py` file as well.
Configuration menu - View commit details
-
Copy full SHA for 47e0117 - Browse repository at this point
Copy the full SHA 47e0117View commit details -
Parse homu state out of comments
For some critical comments, Homu adds extra information about its state in the form of a JSON blob to the comment that isn't visible to the user but is visible in the source for the comment. For example, Homu may leave a comment like the following, where the JSON blob is not visible because of the `<!-- .. -->` markdown/html comments. ⌛ Trying commit abcdef with merge 012345... <!-- homu: {"type":"TryBuildStarted","head_sha":"abcdef","merge_sha":"012345"} --> This change parses this extra information out of the comments and makes it available to the initial synchronization algorithm.
Configuration menu - View commit details
-
Copy full SHA for 4c327b4 - Browse repository at this point
Copy the full SHA 4c327b4View commit details -
Structure for
process_event
; test approvalsCreate the general structure for `process_event` and its testing, and get a long way toward testing approval comments.
Configuration menu - View commit details
-
Copy full SHA for a5fe2e6 - Browse repository at this point
Copy the full SHA a5fe2e6View commit details -
Configuration menu - View commit details
-
Copy full SHA for b693b15 - Browse repository at this point
Copy the full SHA b693b15View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7f9443b - Browse repository at this point
Copy the full SHA 7f9443bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2c6d3b3 - Browse repository at this point
Copy the full SHA 2c6d3b3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2526ffe - Browse repository at this point
Copy the full SHA 2526ffeView commit details -
Keep track of cursor and break up status
Break up the "status" field into multiple orthogonal state fields: * build state (whether the primary is running or has succeeded or failed) * try state (whether the most recent try is running or has succeeded or failed) * approval state (whether the pull request is approved) Previously (and still) these were mostly possible to determine by looking at `state.get_status()` and `state.try_`, but storing them separately helps make state changes more explicit. Also, keep track of the current github synchronization cursor in the pull request state, so that we can use it later.
Configuration menu - View commit details
-
Copy full SHA for a024fbe - Browse repository at this point
Copy the full SHA a024fbeView commit details -
Test that @bors retry resets the state
Test that issuing a `@bors retry` command moves the state from 'pending' to '' for pending pull requests. This is frequently used as a way to yield the current build to a different pull request.
Configuration menu - View commit details
-
Copy full SHA for a9234c7 - Browse repository at this point
Copy the full SHA a9234c7View commit details -
Homu creates a message when a try or build timeout occurs. Handle this to keep the state properly updated.
Configuration menu - View commit details
-
Copy full SHA for 2b83596 - Browse repository at this point
Copy the full SHA 2b83596View commit details
Commits on Jul 8, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 3b2562f - Browse repository at this point
Copy the full SHA 3b2562fView commit details
Commits on Jul 30, 2019
-
Pass around less repository state!
Add more of the state to the Repository class, and make each PullReqState reference it's Repository and get information from there.
Configuration menu - View commit details
-
Copy full SHA for c2b343a - Browse repository at this point
Copy the full SHA c2b343aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 678a195 - Browse repository at this point
Copy the full SHA 678a195View commit details
Commits on Aug 16, 2019
-
Include build history when parsing history
Include a history of all of the tries and all of the builds when parsing the history of a pull request.
Configuration menu - View commit details
-
Copy full SHA for 68bb030 - Browse repository at this point
Copy the full SHA 68bb030View commit details
Commits on Aug 21, 2019
-
Calculate
status
,try_
and others from historyPreviously, we discretely set `status`, `try`, `build_state`, and `try_state` on each event. With the addition of the run histories, we can now glean all of this information from those histories instead of tracking them independently. The results appear to all be identical on the current Homu queue except for one edge case: a pull request was tried, approved, then unapproved. - Using the previous method, the status would be '', because approval changes the status from 'success (try)' to '', and unapproval doesn't change the status. - Using the current method, the status would be 'success (try)', because a successful try has occured for the relevant commit hash and the PR isn't approved.
Configuration menu - View commit details
-
Copy full SHA for a15e1da - Browse repository at this point
Copy the full SHA a15e1daView commit details