Marian Harbach | ebeb154 | 2019-12-13 10:42:46 +0100 | [diff] [blame] | 1 | :linkattrs: |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 2 | = Plugin Lifecycle |
| 3 | |
| 4 | Most of the plugins are hosted on the same instance as the |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 5 | link:https://gerrit-review.googlesource.com[Gerrit project itself,role=external,window=_blank] to make them |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 6 | more discoverable and have more chances to be reviewed by the whole community. |
| 7 | |
| 8 | [[hosting_lifecycle]] |
| 9 | == Hosting Lifecycle |
| 10 | |
| 11 | The process of writing a new plugin goes through different phases: |
| 12 | |
| 13 | - Ideation and Discussion: |
| 14 | + |
| 15 | The idea of creating a new plugin is posted and discussed on the |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 16 | link:https://groups.google.com/d/forum/repo-discuss[repo-discuss,role=external,window=_blank] mailing list. |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 17 | + |
Nasser Grainawi | c219c33 | 2022-03-03 09:47:19 -0700 | [diff] [blame] | 18 | Also see section <<ideation_discussion>> below. |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 19 | |
| 20 | - Prototyping (optional): |
| 21 | + |
| 22 | The author of the plugin creates a working prototype on a public repository |
| 23 | accessible to the community. |
| 24 | + |
Nasser Grainawi | c219c33 | 2022-03-03 09:47:19 -0700 | [diff] [blame] | 25 | Also see section <<plugin_prototyping>> below. |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 26 | |
| 27 | - Proposal and Hosting: |
| 28 | + |
| 29 | The author proposes to release the plugin under the |
| 30 | link:https://www.apache.org/licenses/LICENSE-2.0.html[Apache 2.0 OpenSource |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 31 | license,role=external,window=_blank] and requests the plugin to be hosted on |
| 32 | link:https://gerrit-review.googlesource.com[the Gerrit project site,role=external,window=_blank]. The |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 33 | proposal must be accepted by at least one Gerrit maintainer. In case of |
| 34 | disagreement between maintainers, the issue can be escalated to the |
| 35 | link:dev-processes.html#steering-committee[Engineering Steering Committee]. If |
| 36 | the plugin is accepted, the Gerrit maintainer creates the project under the |
| 37 | plugins path on link:https://gerrit-review.googlesource.com[the Gerrit project |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 38 | site,role=external,window=_blank]. |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 39 | + |
Nasser Grainawi | c219c33 | 2022-03-03 09:47:19 -0700 | [diff] [blame] | 40 | Also see section <<plugin_proposal>> below. |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 41 | |
| 42 | - Build: |
| 43 | + |
| 44 | To make the consumption of the plugin easy and to notice plugin breakages early |
| 45 | the plugin author should setup build jobs on |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 46 | link:https://gerrit-ci.gerritforge.com[the GerritForge CI,role=external,window=_blank] that build the |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 47 | plugin for each Gerrit version that it supports. |
| 48 | + |
Nasser Grainawi | c219c33 | 2022-03-03 09:47:19 -0700 | [diff] [blame] | 49 | Also see section <<build>> below. |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 50 | |
| 51 | - Development and Contribution: |
| 52 | + |
| 53 | The author develops a production-ready code base of the plugin, with |
| 54 | contributions, reviews, and help from the Gerrit community. |
| 55 | + |
Nasser Grainawi | c219c33 | 2022-03-03 09:47:19 -0700 | [diff] [blame] | 56 | Also see section <<development_contribution>> |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 57 | below. |
| 58 | |
| 59 | - Release: |
| 60 | + |
| 61 | The author releases the plugin by creating a Git tag and announcing the plugin |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 62 | on the link:https://groups.google.com/d/forum/repo-discuss[repo-discuss,role=external,window=_blank] |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 63 | mailing list. |
| 64 | + |
Nasser Grainawi | c219c33 | 2022-03-03 09:47:19 -0700 | [diff] [blame] | 65 | Also see section <<plugin_release>> below. |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 66 | |
| 67 | - Maintenance: |
| 68 | + |
| 69 | The author maintains their plugins as new Gerrit versions are released, updates |
| 70 | them when necessary, develops further existing or new features and reviews |
| 71 | incoming contributions. |
| 72 | |
| 73 | - Deprecation: |
| 74 | + |
| 75 | The author declares that the plugin is not maintained anymore or is deprecated |
| 76 | and should not be used anymore. |
| 77 | + |
Nasser Grainawi | c219c33 | 2022-03-03 09:47:19 -0700 | [diff] [blame] | 78 | Also see section <<plugin_deprecation>> below. |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 79 | |
| 80 | [[ideation_discussion]] |
| 81 | == Ideation and Discussion |
| 82 | |
| 83 | Starting a new plugin project is a community effort: it starts with the |
| 84 | identification of a gap in the Gerrit Code Review product but evolves with the |
| 85 | contribution of ideas and suggestions by the whole community. |
| 86 | |
| 87 | The ideator of the plugin starts with an RFC (Request For Comments) post on the |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 88 | link:https://groups.google.com/d/forum/repo-discuss[repo-discuss,role=external,window=_blank] mailing list |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 89 | with a description of the main reasons for starting a new plugin. |
| 90 | |
| 91 | Example of a post: |
| 92 | |
| 93 | ---- |
| 94 | [RFC] Code-Formatter plugin |
| 95 | |
| 96 | Hello, community, |
| 97 | I am proposing to create a new plugin for Gerrit called 'Code-Formatter', see |
| 98 | the details below. |
| 99 | |
| 100 | *The gap* |
| 101 | Often, when I post a new change to Gerrit, I forget to run the common code |
| 102 | formatting tool (e.g. Google-Java-Format for the Gerrit project). I would |
| 103 | like Gerrit to be in charge of highlighting these issues to me and save many |
| 104 | people's time. |
| 105 | |
| 106 | *The proposal* |
| 107 | The Code-Formatter plugin reads the formatting rules in the project config |
| 108 | and applies them automatically to every patch-set. Any issue is reported as a |
| 109 | regular review comment to the patchset, highlighting the part of the code to |
| 110 | be changed. |
| 111 | |
| 112 | What do you think? Did anyone have the same idea or need? |
| 113 | ---- |
| 114 | |
| 115 | The idea is discussed on the mailing list and can evolve based on the needs and |
| 116 | inputs from the entire community. |
| 117 | |
| 118 | After the discussion, the ideator of the plugin can decide to start prototyping |
| 119 | on it or park the proposal, if the feedback provided an alternative solution to |
| 120 | the problem. The prototype phase can be optionally skipped if the idea is clear |
| 121 | enough and receives a general agreement from the Gerrit maintainers. The author |
| 122 | can be given a "leap of faith" and can go directly to the format plugin |
| 123 | proposal (see below) and the creation of the plugin repository. |
| 124 | |
| 125 | [[plugin_prototyping]] |
| 126 | == Plugin Prototyping |
| 127 | |
| 128 | The initial idea is translated to code by the plugin author. The development |
| 129 | can happen on any public or private source code repository and can involve one |
| 130 | or more contributors. The purpose of prototyping is to verify that the idea can |
| 131 | be implemented and provides the expected benefits. |
| 132 | |
| 133 | Once a working prototype is ready, it can be announced as a follow-up to the |
| 134 | initial RFC proposal so that other members of the community can see the code |
| 135 | and try the plugin themselves. |
| 136 | |
| 137 | [[plugin_proposal]] |
| 138 | == Plugin Proposal |
| 139 | |
| 140 | The author decides that the plugin prototype makes sense as a general purpose |
| 141 | plugin and decides to release the code with the same |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 142 | link:https://www.apache.org/licenses/LICENSE-2.0.html[Apache 2.0 license,role=external,window=_blank] |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 143 | as the Gerrit Code Review project and have it hosted on |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 144 | link:https://gerrit-review.googlesource.com[the Gerrit project site,role=external,window=_blank]. |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 145 | |
| 146 | The plugin author formalizes the proposal with a follow-up of the initial RFC |
| 147 | post and asks for public opinion on it. |
| 148 | |
| 149 | Example: |
| 150 | |
| 151 | ---- |
| 152 | Re - [RFC] Code-Formatter plugin |
| 153 | |
| 154 | Hello, community, |
| 155 | thanks for your feedback on the prototype. I have now decided to donate the |
| 156 | project to the Gerrit Code Review project and make it a plugin: |
| 157 | |
| 158 | Plugin name: |
| 159 | /plugins/code-formatter |
| 160 | |
| 161 | Plugin description: |
| 162 | Plugin to allow automatic posting review based on code-formatting rules |
| 163 | ---- |
| 164 | |
| 165 | The community discusses the proposal and the value of the plugin for the whole |
| 166 | project; the result of the discussion can end up in one of the following cases: |
| 167 | |
| 168 | - The plugin's project request is widely appreciated and formally accepted by |
| 169 | at least one Gerrit maintainer who creates the repository as child project of |
| 170 | 'Public-Projects' on link:https://gerrit-review.googlesource.com[the Gerrit |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 171 | project site,role=external,window=_blank], creates an associated plugin owners group with "Owner" |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 172 | permissions for the plugin and adds the plugin's author as member of it. |
| 173 | - The plugin's project is widely appreciated; however, another existing plugin |
| 174 | already partially covers the same use-case and thus it would make more sense |
| 175 | to have the features integrated into the existing plugin. The new plugin's |
| 176 | author contributes his prototype commits refactored to be included as change |
| 177 | into the existing plugin. |
| 178 | - The plugin's project is found useful; however, it is too specific to the |
| 179 | author's use-case and would not make sense outside of it. The plugin remains |
| 180 | in a public repository, widely accessible and OpenSource, but not hosted on |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 181 | link:https://gerrit-review.googlesource.com[the Gerrit project site,role=external,window=_blank]. |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 182 | |
| 183 | [[build]] |
| 184 | == Build |
| 185 | |
| 186 | The plugin's maintainer creates a job on the |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 187 | link:https://gerrit-ci.gerritforge.com[GerritForge CI,role=external,window=_blank] by creating a new YAML |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 188 | definition in the link:https://gerrit.googlesource.com/gerrit-ci-scripts[Gerrit |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 189 | CI Scripts,role=external,window=_blank] repository. |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 190 | |
| 191 | Example of a YAML CI job for plugins: |
| 192 | |
| 193 | ---- |
| 194 | - project: |
| 195 | name: code-formatter |
| 196 | jobs: |
| 197 | - 'plugin-{name}-bazel-{branch}': |
| 198 | branch: |
| 199 | - master |
| 200 | ---- |
| 201 | |
| 202 | [[development_contribution]] |
| 203 | == Development and Contribution |
| 204 | |
| 205 | The plugin follows the same lifecycle as Gerrit Code Review and needs to be |
| 206 | kept up-to-date with the current active branches, according to the |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 207 | link:https://www.gerritcodereview.com/#support[current support policy,role=external,window=_blank]. |
Edwin Kempin | a751c6a | 2019-10-01 13:56:53 +0200 | [diff] [blame] | 208 | During the development, the plugin's maintainer can reward contributors |
| 209 | requesting to be more involved and making them maintainers of his plugin, |
| 210 | adding them to the list of the project owners. |
| 211 | |
| 212 | [[plugin_release]] |
| 213 | == Plugin Release |
| 214 | |
| 215 | The plugin's maintainer is the only person responsible for making and |
| 216 | announcing the official releases, typically, but not limited to, in conjunction |
| 217 | with the major releases of Gerrit Code Review. The plugin's maintainer may tag |
| 218 | his plugin and follow the notation and semantics of the Gerrit Code Review |
| 219 | project; however it is not mandatory and many of the plugins do not have any |
| 220 | tags or releases. |
| 221 | |
| 222 | Example of a YAML CI job for a plugin compatible with multiple Gerrit versions: |
| 223 | |
| 224 | ---- |
| 225 | - project: |
| 226 | name: code-formatter |
| 227 | jobs: |
| 228 | - 'plugin-{name}-bazel-{branch}-{gerrit-branch}': |
| 229 | branch: |
| 230 | - master |
| 231 | gerrit-branch: |
| 232 | - master |
| 233 | - stable-3.0 |
| 234 | - stable-2.16 |
| 235 | ---- |
| 236 | |
| 237 | [[plugin_deprecation]] |
| 238 | == Plugin Deprecation |
| 239 | |
| 240 | The plugin's maintainer and the community have agreed that the plugin is not |
| 241 | useful anymore or there isn't anyone willing to contribute to bringing it |
| 242 | forward and keeping it up-to-date with the recent versions of Gerrit Code |
| 243 | Review. |
| 244 | |
| 245 | The plugin's maintainer puts a deprecation notice in the README.md of the |
| 246 | plugin and pushes it for review. If nobody is willing to bring the code |
| 247 | forward, the change gets merged, and the master branch is removed from the list |
| 248 | of branches to be built on the GerritFoge CI. |
| 249 | |
| 250 | GERRIT |
| 251 | ------ |
| 252 | Part of link:index.html[Gerrit Code Review] |
| 253 | |
| 254 | SEARCHBOX |
| 255 | --------- |