leroyjenkinsplugin edited this page Aug 5, 2014 · 27 revisions

Introduction

Leroy is a freeware software deployment engine that can be integrated into any build system. More information and documentation about Leroy is available at http://www.leroydeploy.com. The purpose of the Leroy-Jenkins plugin is to help integrate Leroy's deployment functionality and configuration management with Jenkin's presentation, artifact storage and access control abilities. This allows one to create a web based application deployment dashboard granting software, system and devops engineers to work together to bring automation and consistency to deployments using a simple xml format stored in SCM.

The Leroy-Jenkins plugin grants the following functionality:

  • Add/remove agents
  • Add/edit/update environments
  • SSH install agents
  • Update leroy controller
  • Generate configurations
  • Perform deployment
  • Pass parameters to deployment
  • Track what deployments occurred on which environment by whom and with which artifacts.
  • Track what workflows ran on different environments by whom and with which artifacts.
  • Configure an environment to fetch deployment config directly from scm or as last good deployment.

Installation

Download

Leroy Jenkins Plugin

Install

Go: Manage Jenkins -> Manage Plugins Click: Advanced, Upload Plugin Choose: leroy.hpi

Setup Controller

  1. Install Leroy plugin
  2. Go into nodes and choose a node that you want to act as your controller. The controller is the staging area where the deployment occurs. Choose [X] Leroy controller and enter a path you want to install leroy. Choose the platform of your node and click "update controller". This will automatically update / install the latest release of leroy to the target folder you specified.
  3. Add agents for each host in your first environment
  4. Add environments and place agents in each environment appropriately.
  5. Assign / create roles for each host in each environment.

Each agent has a name, id and at least one role.

  • name: A unique string identifying this agent (ex: hostname_env_runasuser)
  • id: A logical name identifying this node that is only unique to the environment (ex: web01)
  • role(s): A string used which places the agent in a group. Any role defined in an environment must be used in all environments (ex: web)

Here's an example list of agents in environments:

name id role(s) environment
US-B-WEB01 web01 web build
US-B-WEB02 web02 web build
US-B-JBOSS01 jboss01 jboss build
US-B-JBOSS02 jboss02 jboss build
US-B-db01 db01 db build
US-D-WEB01 web01 web dev
US-D-WEB02 web02 web dev
US-D-JBOSS01 jboss01 jboss dev
US-D-JBOSS02 jboss02 jboss dev
US-D-db01 db01 db dev
US-D-db02 db02 db dev
## Check Leroy project into SCM 1. Create the following folders: commands, workflows, properties, resources 2. Create file: commands/test.sh or command/test.bat inside put: echo this works! 3. Create file: workflows/test.xml add: `` 4. Commit files to SCM

Create new "Leroy Deployment Job"

  1. Click "New Item"
  2. Enter: item name
  3. Choose: "Leroy Deployment Job"
  4. Under "Source Code Management" enter the location where you committed your files to your SCM. Save the job and reload the configurations page. Ensure you enter the proper location where you've checked in your leroy configurations:

Then save it, so the project can load the xml files from your repository:

  1. You should see workflow test and environments listed in "Leroy Target Configurations", choose the workflow and environment you just created, click save.
  2. Ensure that agents are running on each of the hosts in your environment. zip bundles for each agent are created on the node in LEROY_HOME/ for each agent you've created. SSH install will copy these files for you but does not start the agent, nor ensure it runs on boot. You'll have to do this on your own for now.
  3. Deploy

Usage

Create deployment configurations to preset how you want each workflow environment combination to be executed:

Add optional deployment parameters to create modifications to how you want your deployment to behave. Parameters created here become available to Leroy as properties as: ${property} these properties can also be used inside any scripting called by leroy workflows as environment variables. Windows will see %property% in .bat and powershell files and unix will see ${property} as a shell variable, as expected.

In this example deployment we can prompt the user for a deployment password. Such things could be used to prevent accidental deployments to higher environments.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.