Closed
Bug 458172
Opened 18 years ago
Closed 18 years ago
CLOSED TREE notification hook for central repository
Categories
(Developer Services :: Mercurial: hg.mozilla.org, defect)
Developer Services
Mercurial: hg.mozilla.org
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: romaxa, Assigned: johnath)
References
Details
Attachments
(1 file, 4 obsolete files)
|
1.68 KB,
patch
|
ted
:
review+
|
Details | Diff | Splinter Review |
I think it would be nice to have some sort of hg.hook for notifying developers about "closed tree" and some other possible problems and allow them to cancel pushing to the tree...
Comment 1•18 years ago
|
||
This would could be useful. Especially if it could be integrated into bonsai or something as well so that we could get a solution to bug 453433 which tie open/closed statuses back together again in tinderbox/hg/tinderstatus.
Comment 2•18 years ago
|
||
Of course developers are supposed to look at tinderbox no matter what, even if the tree is open: it might be red...
Comment 3•18 years ago
|
||
Which is not to say that this might not be useful, of course.
Comment 4•18 years ago
|
||
Proof of concept hook. Reads status from a wiki page ( https://wiki.mozilla.org/TreeStatus/mozilla-central ). Currently hardcoded to that URL, but could be fixed.
This is about as simple as I could make it. I'm sure there are plenty of other ways to do it. In fact, just mentioning it on IRC I nearly got bikeshedded to death.
Comment 5•18 years ago
|
||
Ted, fwiw (without trying to bikeshed), I'd highly prefer:
https://wiki.mozilla.org/TreeStatus/{repo}
Such that the hook can be easily applied to other repo's, and not "used" if the wiki url is blank.
Such that comm-central can use it easily, tamarin, etc...
Comment 6•18 years ago
|
||
Er, yeah, that's the point. Did you look at the patch?
Comment 7•18 years ago
|
||
So to be honest I don't think this will have much impact. Just an extra line in the display when you push isn't going to say much I think. Maybe if you can include a beep control code when closed ;)
I think it would be better as bonsai was. It would email you if you checked in when the tree was closed.
I also don't think pulling the status from the wiki is great. Ok we always used to have to close in bonsai and update the tinderbox but it would be helpful if we only had to edit the tinderbox status.
Comment 8•18 years ago
|
||
I assumed the hook would still let you check in when the tree was closed, because well otherwise how would I land a fix to get the tree reopened?
Comment 9•18 years ago
|
||
FWIW, if the hook returns 1, the push does not succeed:
$ hg push ../hg-test
pushing to ../hg-test
searching for changes
Tree mozilla-central is CLOSED! (https://wiki.mozilla.org/TreeStatus/mozilla-central)
abort: prechangegroup hook failed
Comment 10•18 years ago
|
||
But... the point of this is that the push is *rejected* if the tree is closed. It doesn't just display something to the console.
Comment 11•18 years ago
|
||
I do not have an answer for that, hence why this is a proof of concept.
The code is simple, so I welcome alternate proposals, especially in the form of patches.
Comment 12•18 years ago
|
||
If you'd like to try this out at home:
1) hg clone http://hg.mozilla.org/users/bsmedberg_mozilla.com/hghooks/
2) Apply my patch here to the hghooks repo
3) export PYTHONPATH=/path/to/hghooks
4) mkdir hg-test && hg init hg-test
5) cat > hg-test/.hg/hgrc
hooks]
prechangegroup = python:mozhghooks.treeclosure.hook
6) hg clone hg-test hg-test-2
7) cd hg-test-2 && echo "hello" > testfile && hg add testfile && hg ci -m "test"
8) hg push ../hg-test
Comment 13•18 years ago
|
||
Oops, in step 5, that should be [hooks]
Comment 14•18 years ago
|
||
Also, FWIW, there's no way to check "push -f" on the server side. We could check the commit message for a specific string, like "bustage fix" or something.
Comment 15•18 years ago
|
||
Or "sheriff-approved"
| Assignee | ||
Comment 16•18 years ago
|
||
This also requires us to be a pretxnchangegroup instead of a prechangegroup, since we need to actually have the changeset to examine.
| Assignee | ||
Updated•18 years ago
|
Attachment #348055 -
Attachment is patch: true
Attachment #348055 -
Attachment mime type: application/octet-stream → text/plain
| Assignee | ||
Comment 17•18 years ago
|
||
(urr - sorry about the change to 'testing' wiki page - obviously if we stick to the wiki approach, we'll not want to land that as-is... :)
| Assignee | ||
Comment 18•18 years ago
|
||
This might be ugly when multiple changesets are pushed? And it might suck for people who don't know how to qimport a patch in order to change the commit message. But one step at a time... :)
Comment 19•18 years ago
|
||
Regarding the tinderbox page, we could just stick something like this in there:
data:text/html,<iframe width="100px" height="50px" src="https://wiki.mozilla.org/index.php?title=TreeStatus/mozilla-central&action=render"></iframe
Comment 20•18 years ago
|
||
Slight revision of johnath's patch.
1) Actually determine repo name dynamically
2) Changed the wiki bits slightly to use templates--{{OPEN}} and {{CLOSED}, so we can change the HTML display without complicating the wiki markup:
https://wiki.mozilla.org/Template:OPEN
https://wiki.mozilla.org/Template:CLOSED
3) Check only the tip revision for the magic words. This way if you needed to push a few patches at once, only the last one would need the magic word.
So, I think we should give this a shot. It's not perfect, but it's better than what we have now (which is nothing).
Attachment #348029 -
Attachment is obsolete: true
Attachment #348055 -
Attachment is obsolete: true
Comment 21•18 years ago
|
||
could you set this up so that the wiki has a list of approved pushers?
that way the sheriff could add a specific pusher to the list to let them do a push. (this is effectively a landing queue w/o the strong ordering)
Comment 22•18 years ago
|
||
We could do anything, it's just code. I don't know that that's worth the effort, though. Seems like social controls are probably enough in that case. (Maybe I'm wrong.)
| Assignee | ||
Comment 23•18 years ago
|
||
2 tiny modifications to ted's latest:
- Don't say anything when the tree is open. That's the default state of affairs, might even be something scripts parse for, but in any case, we don't need it. This is fine as a hook that only "appears" when you do something wrong - ideally most committers will never see it.
- CLOSED_TREE -> CLOSED TREE. It's a string match - no need for it to be excessively computer speakish, so I got rid of the underscore.
I think this is a distinct improvement over what we have now, but I'd really love it if we could get this information out of tinderbox's status field, instead of binding it to the wiki. I agree, it's easy to iframe the wiki in, but we have a controlled system in place for adminstering the tree status message, to make sure that only sheriffs can do so, and it would be nice to key off that directly.
The code that pulls the status blurb for a tree is here:
http://mxr.mozilla.org/mozilla/source/webtools/tinderbox/tbglobals.pl#550
But I don't think status.pl is externally accessible atm. I'd like to be wrong though, because that is a small enough block of text that a) it should pull quickly most of the time, b) it should be scannable for "CLOSED" or "Tree is CLOSED" without false positives.
Attachment #348108 -
Attachment is obsolete: true
Comment 24•18 years ago
|
||
(In reply to comment #23)
> I think this is a distinct improvement over what we have now, but I'd really
> love it if we could get this information out of tinderbox's status field,
> instead of binding it to the wiki. I agree, it's easy to iframe the wiki in,
> but we have a controlled system in place for adminstering the tree status
> message, to make sure that only sheriffs can do so, and it would be nice to key
> off that directly.
While I agree with you in principle, anything that is blocked on improving Tinderbox is doomed to fail. Note our lack of a guilty column after several months of development on mozilla-central. I'd hate to be in the same state with this a few months from now because we really wanted the data from Tinderbox.
Updated•18 years ago
|
Assignee: nobody → ted.mielczarek
OS: Linux → All
Hardware: PC → All
Comment 25•18 years ago
|
||
I'd also say that we don't have to be married to this. We can deploy it and try it out, and if it has too many downsides or sheriffs just can't adapt or whatever, we can stop using it. It's a pretty simple script and it's just a matter of adding the hook to the repo.
Comment 26•18 years ago
|
||
Nit: can there be a timeout adjusted on urlopen() / readlines()? Or just fire a watchdog timer? If WikiMo should become a black hole (or be very slow), we should fail-open if it can't figure out the status in, say, 15 seconds.
| Assignee | ||
Comment 27•18 years ago
|
||
Rewritten to scrape tinderboxes for the tree status. Unfortunately, there isn't a direct mapping between hg repo name and tinderbox tree name, so instead I explicitly map a couple obvious ones, and if any other tree picks up the hook, they can add themselves.
I agree with ted, this kind of thing is cheap to add and remove, feels like it's worth trying out. bsmedberg, what do you think (I assume you're the right reviewer here?)
Assignee: ted.mielczarek → johnath
Attachment #348184 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #348236 -
Flags: review?
Comment 28•18 years ago
|
||
Comment on attachment 348236 [details] [diff] [review]
Check tinderboxes instead of wiki
I think this is fine. Go ahead and push it to hghooks and file a server ops bug to get it deployed on m-c. CC aravind and me, please.
Attachment #348236 -
Flags: review? → review+
Comment 29•18 years ago
|
||
FWIW, there's a hack that lets you set the global socket timeout, but I don't think we want to do that in this hook because it would affect the entire python process, not just the hook:
http://www.voidspace.org.uk/python/articles/urllib2.shtml
Comment 30•18 years ago
|
||
Comment on attachment 348236 [details] [diff] [review]
Check tinderboxes instead of wiki
Fwiw I'm not as happy with this approach as it is an indicator on "Product" not "Tree"
For example, comm-central has "calendar", "suite" and "mail" (TB).
TB can be frozen (meaning mailnews/ and mail/) and c-c can still be open.
I find it bad if this hook itself restricts TB from marking their tinderbox closed because it will close the _entire_ c-c repo.
Comment 31•18 years ago
|
||
Well c-c does not have to use this hook. I think we're only going to add it to m-c for now, the users of c-c can make their own decision.
You're welcome to modify this hook or write your own or whatever you'd like to do.
Comment 32•18 years ago
|
||
Comment on attachment 348236 [details] [diff] [review]
Check tinderboxes instead of wiki
>+ if not hgNameToTinderboxURL.has_key(name) :
>+ print "Unrecognized tree! I don't know how to check closed status for %s." % name
>+ return 1;
I'm not so sure I like the "restrict every push" idea if it doesn't know the tree either.
Secondly, it has always seemed to me that the wiki was fast loading, where the tinderbox waterfall(s) can take a while to load. Is the overhead on using Tinderbox vs Wiki worth it just for the automatic "sheriff abil" the tinderbox already has?
Comment 33•18 years ago
|
||
(In reply to comment #31)
> Well c-c does not have to use this hook. I think we're only going to add it to
> m-c for now, the users of c-c can make their own decision.
If you feel this is the best choice out of current choices for m-c, then who am I to argue? ;-)
> You're welcome to modify this hook or write your own or whatever you'd like to
> do.
If this or "nothing" is c-c's choice for now, I personally would rather nothing, but I'm not trying to force a hand or bikeshed either :-)
| Assignee | ||
Comment 34•18 years ago
|
||
(In reply to comment #32)
> I'm not so sure I like the "restrict every push" idea if it doesn't know the
> tree either.
It's not "restrict every push", it's "restrict every push if you enabled a hook that doesn't know what your tree is doing", and I'd argue that if you do that, you want to know about it immediately.
> Secondly, it has always seemed to me that the wiki was fast loading, where the
> tinderbox waterfall(s) can take a while to load. Is the overhead on using
> Tinderbox vs Wiki worth it just for the automatic "sheriff abil" the tinderbox
> already has?
This uses the static html pages, not the generated ones, so they load pretty quickly in my tests.
Pushed to hghooks, in any event: http://hg.mozilla.org/users/bsmedberg_mozilla.com/hghooks/rev/c5ee26216d0c
| Assignee | ||
Updated•18 years ago
|
Updated•13 years ago
|
Product: mozilla.org → Release Engineering
Updated•12 years ago
|
Product: Release Engineering → Developer Services
You need to log in
before you can comment on or make changes to this bug.
Description
•