Saturday, 18 July 2015

Uploading Plugins Headlessly to Open Eclipse Update Site

This is a very rough blog post! I am responding to a question on twitter about how to upload plugins to an Update Site NSF automatically (e.g. from a build server) So I thought I would put it in a blog post so it would be available for all.
Any questions / corrections please just comment, there will probably be a mistake or two

Domino comes with a standard 'Eclipse Update Site' NSF which you can load your plugins into, and then configure notes.ini so the server will load plugins from that NSF. It has the advantage that it will replicate to other servers and you don't need to touch the filesystem.

Using the standard update site, you can only upload manually, there are UI Dialog's involved etc.

IBM open sourced the template, and Karsten Lehmann made a modified version available on OpenNTF which is exactly the same but has an agent '(API)' that can be called 'headlessly' to upload plugins from a build server.

It also allows deleting Features one-by-one however it won't delete disabled features I have found.

I have made 3 minor modifications to it for our version
  • I made the icons blue instead of purple so I can instantly tell if it is a modified template version
  • I added a Form 'HeadlessImport'. When you run the agent, you pass it a document, I decided to allocate this document to a form so I could inspect it after it had run.
  • I added a View 'HeadlessImports' to view the HeadlessImport documents.

Importing from Build Server 

On the build server, you can run a java program (using jars from jvm/lib/ext) to Create a notes session, get the updatesite database, and then call the (API) agent.
You pass a NotesDocument to the agent, and the notesdocument has necessary instructions to either delete all plugins or to import from the  site.xml
 I have a project on github which has some utilities related to building Xpages and plugins camac/BuildXPages 
Within it I have some custom ant tasks, one of which (as of this week!) is the ImportPluginsTask which does all this for me

Now you don't need to be using ant, you can simply take the same algorithm from the source code (in the execute function) and put it in your own java program. Just make sure you have the Notes jars on your classpath. and maybe you need notes prog dir on your system PATH. I am running it on a server with an id that has no password, so you may need to modify it if your have a password on your id file
The task takes the parameters for server, database and location of site.xml file, creates the notesdocument, runs the agent and then checks the document afterwards to see if there was an error.

Note: when I run the agent I see 4 'Object Variable not set' in the output, I don't think this is impacting upon the success of the plugins, I am still to investigate the cause.

Generating a Site.xml

You need to have a site.xml file, I also have a task to generate one from a list of features and plugins.


Let me know any comments questions!

 

No comments:

Post a Comment