1Tree Sheriffs Documentation
2===========================
3
4### Contents ###
5
6*   [What does a sheriff do?](#what_is_a_sheriff)
7    +   [Skia tree](#skia_tree)
8    +   [DEPS rolls](#deps_rolls)
9    +   [Gold and Perf](#gold_and_perf)
10    +   [Documentation](#sheriff_doc)
11*   [View current and upcoming sheriffs](#view_current_upcoming_sheriffs)
12*   [How to swap sheriff shifts](#how_to_swap)
13*   [Tips for sheriffs](#tips)
14    +   [When to file bugs](#when_to_file_bugs)
15    +   [How to close or re-open the tree](#how_close_tree)
16    +   [Compile bot failures automatically close the tree](#tree_closers)
17    +   [How to revert a CL](#how_to_revert)
18    +   [What to do if DEPS roll fails to land](#deps_roll_failures)
19    +   [How to rebaseline](#how_to_rebaseline)
20
21
22<a name="what_is_a_sheriff"></a>
23What does a sheriff do?
24-----------------------
25
26A sheriff keeps an eye on the tree, DEPS rolls, Gold tool and the Perf tool.
27
28Below is a brief summary of what the sheriff does for each task:
29
30<a name="skia_tree"></a>
31### Skia tree
32* Understand the [buildbots infrastructure](https://skia.org/dev/testing/buildbot).
33* Start watching the [status page](https://status.skia.org) for bot breakages.
34* Track down people responsible for breakages and revert broken changes if there is no easy fix.
35* Close and open the [tree](http://skia-tree-status.appspot.com).
36* Keep the builder comments on the [status page](https://status.skia.org) up to date.
37* File or follow up with [BreakingTheBuildbots bugs](https://code.google.com/p/skia/issues/list?q=label:BreakingTheBuildbots). See the tip on [when to file bugs](#when_to_file_bugs).
38
39<a name="deps_rolls"></a>
40### DEPS rolls
41* Ensure that [AutoRoll Bot](https://skia-tree-status.appspot.com/set_arb_action)'s DEPS rolls land successfully.
42
43<a name="gold_and_perf"></a>
44### Gold and Perf
45* Pay attention for new [Perf](https://perf.skia.org/) and [Gold](https://gold.skia.org/) alerts (by clicking on the bell at the top right of the [status page](https://status.skia.org)).
46* The sheriff's duty here is to make sure that when developers introduce new images or new perf regressions, that they are aware of what happened, and they use these tools to take appropriate action.
47
48<a name="sheriff_doc"></a>
49### Documentation
50* Improve/update this documentation page for future sheriffs, especially the [Tips section](#tips).
51
52In general, sheriffs should have a strong bias towards actions that keep the tree green and then open; if a simple revert can fix the problem, the sheriff <b>should revert first and ask questions later</b>.
53
54
55<a name="view_current_upcoming_sheriffs"></a>
56View current and upcoming sheriffs
57----------------------------------
58
59The list of sheriffs is specified in the [skia-tree-status web app](https://skia-tree-status.appspot.com/sheriff). The current sheriff is highlighted in green.
60The banner on the top of the [status page](https://status.skia.org) also displays the current sheriff.
61
62
63<a name="how_to_swap"></a>
64How to swap sheriff shifts
65--------------------------
66
67If you need to swap shifts with someone (because you are out sick or on vacation), please get approval from the person you want to swap with. Then send an email to skiabot@google.com to have someone make the database change (or directly ping rmistry@).
68
69
70<a name="tips"></a>
71Tips for sheriffs
72-----------------
73
74<a name="when_to_file_bugs"></a>
75### When to file bugs
76
77Pay close attention to the "Failures" view in the [status page](https://status.skia.org).
78Look at all existing [BreakingTheBuildbots bugs](https://code.google.com/p/skia/issues/list?q=label:BreakingTheBuildbots). If the list is kept up to date then it should accurately represent everything that is causing failures. If it does not, then please file/update bugs accordingly.
79
80
81<a name="how_close_tree"></a>
82### How to close or re-open the tree
83
841. Go to [skia-tree-status.appspot.com](skia-tree-status.appspot.com).
852. Change the status.
86 *  To close the tree, include the word "closed" in the status.
87 * To open the tree, include the word "open" in the status.
88 * To caution the tree, include the word "caution" in the status.
89
90
91<a name="how_to_submit_when_tree_closed"></a>
92### How to submit when the tree is closed
93
94* Submit manually using the "git cl land" with the --bypass-hooks flag.
95* Add "NOTREECHECKS=true" to your CL description and use the CQ as usual.
96
97
98<a name="tree_closers"></a>
99### Compile bot failures automatically close the tree
100
101A failure of the build steps in all compile bots automatically closes the tree. Sheriffs will have to manually reopen the tree manually when they deem the problem fixed.
102
103Note: The tree is not closed automatically if the last run of the failed compile builder had the same failing step. The tree is also not closed if the tree was automatically closed less than 10 mins ago. If the tree is already closed then no action is taken.
104
105
106<a name="how_to_revert"></a>
107### How to revert a CL
108
109See the revert documentation [here](https://skia.org/dev/contrib/revert).
110
111
112<a name="deps_roll_failures"></a>
113### What to do if DEPS roll fails to land
114
115A common cause of DEPS roll failures are layout tests. Find the offending Skia CL by examining the commit hash range in the DEPS roll and revert (or talk to the commit author if they are available). If you do revert then keep an eye on the next DEPS roll to make sure it succeeds.
116
117If a Skia CL changes layout tests, but the new images look good, the tests need to be rebaselined. See [Rebaseline Layout Tests](#how_to_rebaseline).
118
119<a name="how_to_rebaseline"></a>
120### Rebaseline Layout Tests (i.e., add suppressions)
121
122* First create a Chromium bug:
123  * goto [crbug.com](https://crbug.com)
124  * Make sure you’re logged in with your Chromium credentials
125  * Click “New Issue”
126  * Summary: “Skia image rebaseline”
127  * Description:
128      * DEPS roll #,
129      * Helpful message about what went wrong (e.g., “Changes to how lighting is scaled in Skia r#### changed the following images:”)
130      * Layout tests effected
131      * You should copy the list of affected from stdio of the failing bot
132  * Status: Assigned
133  * Owner: yourself
134  * cc: reed@, bsalomon@, robertphillips@ & developer responsible for changes
135  * Labels: OS-All & Cr-Blink-LayoutTests
136  * If it is filter related, cc senorblanco@
137
138* (Dispreferred but faster) Edit [skia/skia_test_expectations.txt](https://chromium.googlesource.com/chromium/src/+/master/skia/skia_test_expectations.txt)
139  * Add # comment about what has changed (I usually paraphrase the crbug text)
140  * Add line(s) like the following after the comment:
141      * crbug.com/<bug#youjustcreated> foo/bar/test-name.html [ ImageOnlyFailure ]
142  * Note: this change is usually done in the DEPS roll patch itself
143
144* (Preferred but slower) Make a separate Blink patch by editing LayoutTests/TestExpectations
145  * Add # comment about what has changed (I usually paraphrase the crbug text)
146  * Add line(s) like the following after the comment:
147      * crbug.com/<bug#youjustcreated> foo/bar/test-name.html [ NeedsManualRebaseline ]
148  * Commit the patch you created and wait until it lands and rolls into Chrome
149
150* Retry the DEPS roll (for the 1st/dispreferred option this usually means just retrying the layout bots)
151* Make a Blink patch by editing LayoutTests/TestExpectations
152  * Add # comment about what has changed
153  * Add line(s) like the following after the comment:
154      * crbug.com/<bug#youjustcreated> foo/bar/test-name.html [ NeedsRebaseline ]
155        * (if you took the second option above you can just edit the existing line(s))
156
157* If you took the first/dispreferred option above:
158  * Wait for the Blink patch to roll into Chrome
159  * Create a Chrome patch that removes your suppressions from skia/skia_test_expectations.txt
160
161
162