Stephen Martinis | b5ad5b22 | 2018-11-08 01:24:04 | [diff] [blame^] | 1 | # CQ |
| 2 | |
| 3 | This document describes how the Chromium Commit Queue (CQ) is structured and |
| 4 | managed. This is specific for the Chromium CQ. Questions about other CQs should |
| 5 | be directed to infra-dev@chromium.org. |
| 6 | |
| 7 | [TOC] |
| 8 | |
| 9 | ## Purpose |
| 10 | |
| 11 | The Chromium CQ exists to test developer changes before they land into |
| 12 | [chromium/src](https://chromium.googlesource.com/chromium/src/). It runs all the |
| 13 | test suites which a given CL affects, and ensures that they all pass. |
| 14 | |
| 15 | ## Options |
| 16 | |
| 17 | * `COMMIT=false` |
| 18 | |
| 19 | You can mark a CL with this if you are working on experimental code and do not |
| 20 | want to risk accidentally submitting it via the CQ. The CQ will immediately |
| 21 | stop processing the change if it contains this option. |
| 22 | |
| 23 | * `CQ_INCLUDE_TRYBOTS=<trybots>` |
| 24 | |
| 25 | This flag allows you to specify some additional bots to run for this CL, in |
| 26 | addition to the default bots. The format for the list of trybots is |
| 27 | "bucket:trybot1,trybot2;bucket2:trybot3". |
| 28 | |
| 29 | * `NOPRESUBMIT=true` |
| 30 | |
| 31 | If you want to skip the presubmit check, you can add this line, and the commit |
| 32 | queue won't run the presubmit for your change. This should only be used when |
| 33 | there's a bug in the PRESUBMIT scripts. Please check that there's a bug filed |
| 34 | against the bad script, and if there isn't, [file one](https://crbug.com/new). |
| 35 | |
| 36 | * `NOTREECHECKS=true` |
| 37 | |
| 38 | Add this line if you want to skip the tree status checks. This means the CQ |
| 39 | will commit a CL even if the tree is closed. Obviously this is strongly |
| 40 | discouraged, since the tree is usually closed for a reason. However, in rare |
| 41 | cases this is acceptable, primarily to fix build breakages (i.e., your CL will |
| 42 | help in reopening the tree). |
| 43 | |
| 44 | * `NOTRY=true` |
| 45 | |
| 46 | This should only be used for reverts to green the tree, since it skips try |
| 47 | bots and might therefore break the tree. You shouldn't use this otherwise. |
| 48 | |
| 49 | * `TBR=<username>` |
| 50 | |
| 51 | [See policy](https://chromium.googlesource.com/chromium/src/+/master/docs/code_reviews.md#TBR-To-Be-Reviewed) |
| 52 | of when it's acceptable to use TBR ("To be reviewed"). If a change has a TBR |
| 53 | line with a valid reviewer, the CQ will skip checks for LGTMs. |
| 54 | |
| 55 | ## FAQ |
| 56 | |
| 57 | ### What exactly does CQ run? |
| 58 | |
| 59 | CQ runs the jobs specified in [cq.cfg](../../infra/config/branch/cq.cfg). |
| 60 | |
| 61 | Some of these jobs are experimental. This means they are executed on a |
| 62 | percentage of CQ builds, and the outcome of the build doesn't affect if the CL |
| 63 | can land or not. See the schema linked at the top of the file for more |
| 64 | information on what the fields in the config do. |
| 65 | |
| 66 | ### Why did my CL fail the CQ? |
| 67 | |
| 68 | Please follow these general guidelines: |
| 69 | 1. Check to see if your patch caused the build failures, and fix if possible. |
| 70 | 1. If compilation or individual tests are failing on one or more CQ bots and you |
| 71 | suspect that your CL is not responsible, please contact your friendly |
| 72 | neighborhood sheriff by filing a |
| 73 | [sheriff bug](https://bugs.chromium.org/p/chromium/issues/entry?template=Defect%20report%20from%20developer&labels=Sheriff-Chromium&summary=%5BBrief%20description%20of%20problem%5D&comment=What%27s%20wrong?). |
| 74 | If the code in question has appropriate OWNERS, consider contacting or CCing |
| 75 | them. |
| 76 | 1. If other parts of CQ bot execution (e.g. `bot_update`) are failing, or you |
| 77 | have reason to believe the CQ itself is broken, or you can't really |
| 78 | tell what's wrong, please file a [trooper bug](g.co/bugatrooper). |
| 79 | |
| 80 | In both cases, when filing bugs, please include links to the build and/or CL |
| 81 | (including relevant patchset information) in question. |
| 82 | |
| 83 | ### How do I add a new builder to the CQ? |
| 84 | |
| 85 | There are several requirements for a builder to be added to the Commit Queue. |
| 86 | |
| 87 | * All the code for this configuration must be in Chromium's public repository or |
| 88 | brought in through [src/DEPS](../../DEPS). |
| 89 | * Setting up the build should be straightforward for a Chromium developer |
| 90 | familiar with existing configurations. |
| 91 | * Tests should use existing test harnesses i.e. |
| 92 | [gtest](../../third_party/googletest). |
| 93 | * It should be possible for any committer to replicate any testing run; i.e. |
| 94 | tests and their data must be in the public repository. |
| 95 | * Median cycle time needs to be under 40 minutes for trybots. 90th percentile |
| 96 | should be around an hour (preferrably shorter). |
| 97 | * Configurations need to catch enough failures to be worth adding to the CQ. |
| 98 | Running builds on every CL requires a significant amount of compute resources. |
| 99 | If a configuration only fails once every couple of weeks on the waterfalls, |
| 100 | then it's probably not worth adding it to the commit queue. |
| 101 | |
| 102 | Please email [email protected], who will approve new build configurations. |
| 103 | |
| 104 | ## Flakiness |
| 105 | |
| 106 | The CQ can sometimes be flaky. Flakiness is when a test on the CQ fails, but |
| 107 | should have passed (commonly known as a false negative). There are a few common |
| 108 | causes of flaky tests on the CQ: |
| 109 | |
| 110 | * Machine issues; weird system processes running, running out of disk space, |
| 111 | etc... |
| 112 | * Test issues; individual tests not being independent and relying on the order |
| 113 | of tests being run, not mocking out network traffic or other real world |
| 114 | interactions. |
| 115 | |
| 116 | CQ handles flakiness mainly by retrying tests. It retries at a few different |
| 117 | levels: |
| 118 | |
| 119 | 1. Per test retries. |
| 120 | |
| 121 | Most test suites have test retries built into them, which |
| 122 | retry failed tests a few times. |
| 123 | 1. Per build retries. |
| 124 | |
| 125 | After a test suite fails in a build, the build will retry the test suite |
| 126 | again, both without patch, and with the patch applied. |
| 127 | 1. Per CQ run retries. |
| 128 | |
| 129 | If a build fails, CQ will retry the individual trybot which failed. |
| 130 | |
| 131 | ## Help! |
| 132 | |
| 133 | Have other questions? Run into any issues with the CQ? Email |
| 134 | [email protected], or file a [trooper bug](g.co/bugatrooper). |