Add status-based test exemptions#54
Conversation
|
Hey, thanks for the PR! This is failing flake8, so it should be fixed before merge. I'm not the most adequate person to review this so... r? @Manishearth |
|
flake8 has some opinions: |
Factor out the git repo setup part, which will be used again by an upcoming patch. Also make use of a lambda to help abbreviate commands.
Split out the travis exception logic into two functions for easier reuse. Also unwind the logic a bit so it's easier to read.
784edcf to
f36186b
Compare
|
⬆️ Updated to please flake8. |
homu/server.py
Outdated
| except Exception as ex: | ||
| logger.warn('/callback encountered an error during github oauth callback') | ||
| lazy_debug(logger, lambda: 'github oauth callback err: {}'.format(ex)) | ||
| s = 'github oauth callback err: {}'.format(ex) |
There was a problem hiding this comment.
This makes the thing un-lazy, since s is unconditionally evaluated. Set s to lambda: ... and use it directly
|
Overall looks good. Most CI services run two builds -- one per commit, and one per PR. For status builds we only provide the "per commit" context ( Perhaps we should allow an optional alternate context for the same status in the cfg, and if any of the two contexts pass, exempt the build? |
|
The other issue with the "per commit" status is that it can be spoofed by changing the travis settings for your fork. |
|
If we're concerned about spoofing, a simple fix would be to support something like an (It's part of the status data github returns) |
|
But the bot never creates the commit in a PR, it only creates a merge commit later. Exemption is for stuff done before you even r+. |
I'm not sure I follow this, could you expand? The status-based exemption added here isn't meant to exempt testing of the PR itself by external CI tools like Travis, but rather the "second" testing of the commits on the auto branch. (It sounds like you're talking about telling the CI service to skip even the "first" test of the PR/branch, is that the case?)
I'm guessing you're referring to the travis case here (where we expect |
No 😄
Yes 😄 I know the travis logic was left alone, but I want users to have the possibility of using that logic for any CI service. Appveyor for example provides two contexts so it can be used there. |
|
Ahh, got it thanks for the clarification! Will make the appropriate tweaks. |
|
⬆️ Added a new |
|
I didn't review every bit of the code in detail - there are a lot of changes, but (as usual) it all looks good at a high level. I have a bit of uncertainty around the semantics of this in different cases (e.g. for users doing fast-forwards vs merges). How much did you test this? I have no problem updating our staging homu. One thing I've been thinking about that might help is to have two testers - one that's fast/sanity, and one that does expensive tests. The PR tester could do both, but prioritize sanity testing PRs first. The expensive test would be run on the merge queue, and I think we could equally well support the "rollup" merge for fast forwards too (if we don't today). |
Thanks! By "different cases" do you mean different settings (e.g.
I got a set up here. I only tested it with
Yup, I can definitely see the usefulness for something like this as a next step. Status-based exemption would help here too so that homu doesn't have to wait for the expensive test if the PR tester already got to it by the time the PR gets accepted. |
To clarify, I only tested with those on (since I consider my changes orthogonal to those), but I did test all the the new code paths as well as the travis exception. You can see the PR history on https://github.com/jlebon/rpm-ostree to see what it looks like. |
|
(probably will review this soon, sorry for the delay) |
|
Looks good to me with the pr_context changes. Thanks! |
|
One thing to bear in mind is @jlebon and I are using homu with fast forwards and squashing, hence we use a |
These patches bring status-based test exemptions similar to what we already have for Travis CI.
In most cases, the same tests are run on both PRs and the auto branch. If these tests output a commit status, we can be a bit smarter about testing. For example, if the PR is fully rebased and already passed the statuses we would expect on the auto branch, then there's no point in retesting it.
The first two patches do some clean ups and refactoring in preparation for the third patch, which introduces the
status_based_exemptionsetting.This change is