UrbanCode Deploy agents operate through the execution of plugin steps. Plugins provide the integrations that give the real power to an ARA solution. Existing plugins can be downloaded and partners and customers can also build their own plugins. The controller server sends the agent instructions by telling it to run a plugin step, with information including:
- Which plugin it wants run
- The particular step from the plugin
- The plugin version it wants
- Any parameters it needs to pass to the plugin
If the agent does not have the appropriate version of the plugin, it just downloads it from the server. Then it runs the step with the appropriate parameters and processes the results while streaming log information back to the controller. This provides several advantages:
- Plugins can be added/upgraded independently of controller upgrades
- Plugins are transparently delivered to the agents that use them
- All executed deployments log the version of the plugins used for audibility and repeatability purposes
- If needed, old versions of plugins may also be used in deployment processes
Building Your Own UrbanCode Plugins
The Anatomy of a Plugin
There are five parts to a plugin:
- Plugin.xml: Definition - what steps, input and how to invoke
- Upgrade rules
- Info.xml: Versioning
- Payload: Scripts, libraries and tools that accomplish a plugin's goals
- Packaging: Wrap contents in a ZIP file
1. The plugin definition is expressed in the plugin.xml. It's concerned with the definition of the properties/settings used by various levels of the plugin and lists the steps the plugin makes available as well as which commands or scripts the plugin should execute.
2. The upgrade rules are what supports plugin version upgrades and are required when adding or renaming steps or properties.
3. The upgrade rules (2) are expressed within info.xml.
4. The payload is everything that makes the integration happen - things like stop/start application, check heap size, create cluster etc.
5. Pieces one to four are all wrapped up and zipped ready to be sent and executed.
Plugins have at least one step and some can have many. Each step is an independently configurable entity in the UrbanCode Deploy editor and has four elements:
The properties element is a container for property child elements and can contain any number of property elements. Property values can be supplied at design time or runtime. The post processing element provides error-handling capabilities and sets property values that can be used by other steps. Thecommand element runs the step's function. The function can be defined completely by the element, or be constructed in part or entirely from the step's properties at design time or at runtime. You decide.
In addition to a step's own properties, a command has access to:
- Properties set earlier by other steps within the process
- Properties set by the application that started the component process
- Properties on the target environment and resource
You can write plugin steps in any script you like - Perl, Ruby, VB Script, Python but IBM UrbanCode themselves prefer to write in Groovy because Groovy is:
- On every agent
- Cross platform
- Excellent at XML
- Fun to learn, concise and effective
Make Your Plugin Available
Once you've finishing your plugin you can upload it into IBM UrbanCode Deploy to make it available to your users. Import the archive file using the UrbanCode Automation Plugins pane (Settings > Automation Plugins > Load Plugin). Ta da!