I'm not trying to sidestep the discussion on the other thread, but I thought it would be useful to have a straw-man proposal covering more than just versioning of each plugin, with an eye towards how to make plugin/extension discovery and installation easier for users of non-core plugins.
The end goal is to make plugin installation and setup as easy as:$ java -jar gerrit.war init -d my-site -p gitiles,plugin2,...I think it's important to have plugin installation as part of init because plugins can/should define InitSteps, and requiring users to download plugins and rerun init adds quite a bit more friction. My proposal may seem a bit complex, but I would like to keep it as simple as possible while enabling easy plugin management with init.
The first thing we need is a central repository of plugin binaries, to which plugin authors (who need not be Gerrit contributors/maintainers) can contribute their plugins. Shawn and I talked briefly about this last night and one idea was to put each plugin in its own Google Cloud Storage bucket:This bucket is owned by the same Google Group that is listed in Gerrit as the project owner for the plugins/$pluginname project; we need to use separate buckets because Google Cloud Storage only has per-bucket permissions, not per-directory (gerrit-plugins/$pluginname/ uses the ACL on gerrit-plugins). So there is an additional setup step for the Gerrit maintainers when a new plugin project is created, but then it's out of maintainers' hands.
Now, on to versioning. I'm more interested in determining the _Gerrit version(s)_ for each plugin JAR, which ensures init downloads the version that works for it. I'm less interested in how each plugin project does its branching and versioning _of the plugin_, since as far as I'm concerned plugins are independent projects and can set up whatever branch/release process they want.So, a straw-man proposal for versioning. In its the JAR manifest, each plugin includes (optional) min/max Gerrit versions:<Gerrit-MinVersion>2.6</Gerrit-MinVersion><Gerrit-MaxVersion>2.7.*</Gerrit-MaxVersion>In this example, the plugin works with Gerrit >=2.6 and <2.8. Both endpoints are optional. This can be verified at plugin load time by Gerrit, which should know its running version number. These versions refer to the running Gerrit version, not the compile-time plugin/extension API version, the reason being that a single plugin/extension API JAR may work with more than one running version of Gerrit. Especially for plugins, which can depend on arbitrary parts of Gerrit, it's really up to the plugin developer to know the exact range of compatible versions.
The next issue is how init discovers which plugin version to download. Basically we need to store metadata somewhere for all available plugin versions; downloading entire plugin JARs just to extract the manifest and check the version is dumb. Here are some possibilities, in no particular order:-For each $pluginname-$version.jar, store alongside it $pluginname-$version.manifest that is the manifest from the JAR.-Store version metadata in the HTTP headers in Google Cloud Storage, like "X-Gerrit-MinVersion: 2.6", "X-Gerrit-MaxVersion: 2.7.*".-Encode the Gerrit version number directly in the JAR filename, like $pluginname-$version_gerrit-2.6_gerrit-2.7.*.jar.-Store a single $pluginname.versions with simple JSON contents, like {"X.Y": {"gerrit-minversion": "2.6", "gerrit-maxversion": "2.7.*"}}.These have various advantages and disadvantages, for example the first two are straightforward enough but require the client to poll multiple versions.
One concern I've ignored so far is security: init -p plugin makes it trivially easy to download and run arbitrary code form the internet, and independent permissions for plugin projects means plugin code isn't necessarily audited by Gerrit maintainers. I'm open to suggestions (ACL management, JAR signing, etc.) as to how to deal with this.
On Thu, Mar 28, 2013 at 10:12 AM, Dave Borowitz <dbor...@google.com> wrote:
I'm not trying to sidestep the discussion on the other thread, but I thought it would be useful to have a straw-man proposal covering more than just versioning of each plugin, with an eye towards how to make plugin/extension discovery and installation easier for users of non-core plugins.The end goal is to make plugin installation and setup as easy as:$ java -jar gerrit.war init -d my-site -p gitiles,plugin2,...I think it's important to have plugin installation as part of init because plugins can/should define InitSteps, and requiring users to download plugins and rerun init adds quite a bit more friction. My proposal may seem a bit complex, but I would like to keep it as simple as possible while enabling easy plugin management with init.I agree. I think this is really important if we want plugins to really take off.The first thing we need is a central repository of plugin binaries, to which plugin authors (who need not be Gerrit contributors/maintainers) can contribute their plugins. Shawn and I talked briefly about this last night and one idea was to put each plugin in its own Google Cloud Storage bucket:This bucket is owned by the same Google Group that is listed in Gerrit as the project owner for the plugins/$pluginname project; we need to use separate buckets because Google Cloud Storage only has per-bucket permissions, not per-directory (gerrit-plugins/$pluginname/ uses the ACL on gerrit-plugins). So there is an additional setup step for the Gerrit maintainers when a new plugin project is created, but then it's out of maintainers' hands.This sounds totally reasonable. My only question is on building--would we wantsome kind of shared build system that publishes the jars for us, or will it be upto the maintainer(s) to build+upload? The latter is probably the path of leastresistance, but it's good to be clear.
Now, on to versioning. I'm more interested in determining the _Gerrit version(s)_ for each plugin JAR, which ensures init downloads the version that works for it. I'm less interested in how each plugin project does its branching and versioning _of the plugin_, since as far as I'm concerned plugins are independent projects and can set up whatever branch/release process they want.So, a straw-man proposal for versioning. In its the JAR manifest, each plugin includes (optional) min/max Gerrit versions:<Gerrit-MinVersion>2.6</Gerrit-MinVersion><Gerrit-MaxVersion>2.7.*</Gerrit-MaxVersion>In this example, the plugin works with Gerrit >=2.6 and <2.8. Both endpoints are optional. This can be verified at plugin load time by Gerrit, which should know its running version number. These versions refer to the running Gerrit version, not the compile-time plugin/extension API version, the reason being that a single plugin/extension API JAR may work with more than one running version of Gerrit. Especially for plugins, which can depend on arbitrary parts of Gerrit, it's really up to the plugin developer to know the exact range of compatible versions.This all sounds reasonable. And yeah, plugin devs should know what versions ofGerrit their plugin works for.The next issue is how init discovers which plugin version to download. Basically we need to store metadata somewhere for all available plugin versions; downloading entire plugin JARs just to extract the manifest and check the version is dumb. Here are some possibilities, in no particular order:-For each $pluginname-$version.jar, store alongside it $pluginname-$version.manifest that is the manifest from the JAR.-Store version metadata in the HTTP headers in Google Cloud Storage, like "X-Gerrit-MinVersion: 2.6", "X-Gerrit-MaxVersion: 2.7.*".-Encode the Gerrit version number directly in the JAR filename, like $pluginname-$version_gerrit-2.6_gerrit-2.7.*.jar.-Store a single $pluginname.versions with simple JSON contents, like {"X.Y": {"gerrit-minversion": "2.6", "gerrit-maxversion": "2.7.*"}}.These have various advantages and disadvantages, for example the first two are straightforward enough but require the client to poll multiple versions.I kind of like option 4. JSON is easily editable and readable by humans as well asmachines.One concern I've ignored so far is security: init -p plugin makes it trivially easy to download and run arbitrary code form the internet, and independent permissions for plugin projects means plugin code isn't necessarily audited by Gerrit maintainers. I'm open to suggestions (ACL management, JAR signing, etc.) as to how to deal with this.Signing would be nice, since then you could specify to only install signed plugins,or allow unsigned too. Of course the really paranoi^H^H^H^H^H^H^H security-conscious probably won't use an auto-downloading system and will just fetch theplugins by hand.
-Chad
On 03/28/2013 10:13 PM, Shawn Pearce wrote:Huge +1 for plugins UI configuration and for keeping it in Git branches. Going even further sys admins can give configuration permissions for given plugin to given group. Of course this will make project configuration even more complicated ;)
Ideally plugins would be configured through the web interface if they
want fancy editing, but really their configuration settings should be
saved into Git branches somewhere so admins can inspect history of
settings, rollback, etc. That's all pie in the sky.
(...)
How about:
<Gerrit-RuntimeVersion>[2.6,2.8)</Gerrit-RuntimeVersion >
This matches with how the OSGi version format is used. And is easier to read.
For sure I miss something, but why Gerrit is not using OSGI as plugin infrastructure? For sure this will solve many problems and cut off some discussions like this 'how (and where) store api version number". With OSGI we could reuse existing plugin architecture and tools like tycho...
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
+1 on how Jenkins does it, perhaps we can borrow their code?
+1 on how Jenkins does it, perhaps we can borrow their code?
From: Luciano Carvalho [mailto:lsca...@gmail.com]
Sent: 29 March 2013 18:24
To: Thomas Swindells (tswindel)
Cc: Jason Axelson; Alex Blewitt; Deniz Türkoglu; Dariusz Luksza; Shawn Pearce; Dave Borowitz; repo-discuss Discussion
Subject: Re: Proposal: Gerrit plugin versioning, discovery, installation
On Fri, Mar 29, 2013 at 2:28 AM, Thomas Swindells (tswindel) <tswi...@cisco.com> wrote:
+1 on how Jenkins does it, perhaps we can borrow their code?
I agree! The way plugins are handled in Jenkins/Hudson(sigh) are one of the things that made 'em so popular.
You're proposing a borrowing of the wiki page format only right? Because the whole plugin architecture won't match.
[Thomas Swindells] To be honest I’ve no idea how their code works so have no real opinion of how far we can borrow. I don’t know if there is scope to borrow a bit further and include the code which retrieves the list of what plugins are available, whether there are updates to them available, handling downgrading of them and trigger the install etc
I'm not trying to sidestep the discussion on the other thread, but I thought it would be useful to have a straw-man proposal covering more than just versioning of each plugin, with an eye towards how to make plugin/extension discovery and installation easier for users of non-core plugins.The end goal is to make plugin installation and setup as easy as:$ java -jar gerrit.war init -d my-site -p gitiles,plugin2,...