Using the Jenkins vRealize Automation Plugin

Background

Someone at work recently reached out to me because they were trying to make the vRealize Automation(vRA) plugin for Jenkins work with one of our vRA instances. This person was having issues getting it to work.  I knew about the plugin because it’s one of the integration points we’ve been thinking about working towards, but not something I’d actually dug into much.

The plugin has some minimal documentation associated with it which was good for dead simple blueprints, but the ones  my co-worker was trying use have a number of custom properties associated with them and we were struggling to get it to work. I think I’ve now got an understanding of how to decode the blueprint properties and supply the necessary info to Jenkins to make the blueprint work so I thought I’d share that here for others… It’s worth reading the documentation  included on the GitHub page where the plugin source lives (https://github.com/jenkinsci/vmware-vrealize-automation-plugin) as a precursor to this.

The issue is trying to figure out how to build the values to populate the Parameter JSON field  as shown below.

The TLDR version

 

I’ll post a longer version of this showing the process I went through to figure this out but for those who just want to get going here’s the skinny…

When talking about vRA there are 3 levels/types  of parameters that one can set.

  • Request Specific
  • Blueprint specific
  • Blueprint component specific

 

Request specific includes things like the “Description” and “Reason for Request” fields etc. that are part of every IaaS-ish request.

 

Blueprint specific would include things on the Properties page for the deployment (ex: LT.jenkinsJobNumber below)

 

Blueprint specific components could be settings on a VM (ex below vSphere_Machine_1)  or a software component etc.

 

Request specific values can be built using the following format:

So to populate the Description field the result would be:

For the  blueprint  specific properties  the format should look like :

So as in the example above where we want to set LT.jenkinsJobNumber to a value of 123 we’d end up with:

For component properties its:

 

In the blueprint above the VM component is named vSphere_Machine_1. And if we want to set the LT.jenkins value to 456 we’d end up with:

 

{

So if we wanted to set all three of these values the form in Jenkins would have a “Parameter JSON” field for each of the JSON snippets and look something like:

 

These appear to be stackable. So if you wanted to set both the “Description” and  “Reason for Request” fields on the deployment there would be a Parameter setting for each one of the fields.

Hopefully this will help other folks get this working faster.