Use vRealize Automation with Jenkins

Use vRealize Automation with Jenkins

May 2, 2016 2 By Eric Shanks

If you’ve been following the rest of this series about using Jenkins, you’re starting to see that there are a lot of capabilities that can be used to suit whatever use case you have for deploying and testing code. This post focuses on a great plugin that was recently pushed out by Kris Thieler (aka inkysea) and Paul Gifford. These guys have published a Jenkins Plugin for vRealize Automation.

Just like we’ve done in other posts, the first step is to install the plugin in the Manage Plugins section of Jenkins.

Jenkins-vRA7-1

Sample Use Case

So here is my basic use case for the purposes of this article. Assume I’ve got a web server with a website. I’m using vRA and vRO to deploy a virtual machine and then download my site code from GIT. The example website is shown below.

Jenkins-vRA7-WebV1

 

Now I need a MAJOR overhaul to the website and will be pushing some code changes to GIT. We can use the GIT plugin that we’ve used before along with the vRA plugin to deploy a new web server and pull down my new code each time I deploy my code.

To get started, I’ll create a new Jenkins Project. The project will be configured to monitor my GIT branch for changes. This could be done either with polling, or via a webhook.
Jenkins-vRA7-2

Next, we configure the vRA settings in the project. Some more detailed instructions can be found over at the wiki page but the basics require you to enter in the vRA URL, Tenant, login information and the Blueprint that will be deployed. More settings are available such as adding JSON configuration parameters and using variables instead of hard coding in the vRA URLs. If you’ll be doing this a lot, I encourage you to go check out the details on the wiki page.

Jenkins-vRA7-3

Time for a Test

So here we go. I’ve made my serious changes to my website code.

Jenkins-vRA7-CodeChange1

You can see that I’ve made my changes in GIT to the index.html file.
Jenkins-vRA7-CodeChange2

Now I push my code to my Bitbucket (Git) server.
Jenkins-vRA7-CodeChange3

Jenkins gets notified of the changes, and starts its build.

Jenkins-vRA7-4

vRA will then kick off the build of the blueprint and any stubs, event subscriptions or approvals that might be setup for that blueprint. After a few moments, the machine will be built and show up in the vRA console.

Jenkins-vRA7-5

If I go login to the new machine that was provisioned, I can see that the new code has been deployed.

Jenkins-vRA7-WebV2

Summary

It’s really awesome that Jenkins can not only test your code changes automatically and on a schedule, but can also leverage other tools like vRealize Automation to build an entire environment. The example in this article was very basic, but you could imagine using this in concert with a configuration management tool like Puppet, Chef, Ansible, or a way to test changes to blueprints in vRA as well as app or web code. The sky is the limit here and I’d love to hear in the comments what you came up with.