Triggering a vRO workflow with Jenkins

This post is going to cover triggering a vRealize Orchestrator workflow with Jenkins.

Integrating Jenkins and vRO can be very useful given the number of environments that are running VMware along with the adoption of CI/CD and DevOps practices. The plugin allows us to easily integrate VMware tasks into build pipelines in a more native fashion than some of the other tools available.

Create Test vRO Workflow

We’re going to create a simple vRO workflow to test the Jenkins vRO integration by triggering a workflow with a single string input.

We’ll just create a “JenkinsTest” workflow that we can use just to test the Jenkins vRO plugin.

Let’s add a scriptable task with the code below to output the string received from Jenkins to the system log.

System.log("Parameter passed from Jenkins: " + jenkinsParam1);  

With the Javascript code added we just need to bind an input parameter named “jenkinsParam1” to the scriptable task that we just created.

That completes the vRO workflow that we’ll use to test with, save and close the workflow.

Install Jenkins vRO Plugin

The first thing we need to do is install the Jenkins vRO plugin (https://wiki.jenkins-ci.org/display/JENKINS/VMware+vRealize+Orchestrator+Plugin).

Click “Manage Jenkins” from the sidebar on the left side of the page.

Click “Manage Plugins” to navigate to the plugin manager.

Select the “Available” tab, type “orchestrator” into the “Filter:” text box to find the vRealize Orchestrator Plugin. Select the plugin and click “Download now and install after restart” assuming that there are no currently running jobs.

Select “Restart Jenkins when installation is complete and no jobs are running” to restart the Jenkins server after the plugin has been installed.

Create Jenkins Job

Now that we’ve got the plugin installed we can now create a job to test the plugin.

Click “New Item” from the sidebar on the left side of the page to create a new Jenkins job.

Provide a name for the job and select “Freestyle project” and click “OK” to create the job.

Select “Execute Orchestrator Workflow” from the “Add build step” drop-down under the “Build” section.

Enter the vRO connection and workflow information.

Server URL: https://vroappliance:8281  
User Name: vcoadmin  
Password: vcoadmin  
Workflow Name: JenkinsTest  

The username will either be vcoadmin or a vCenter SSO user account if vSphere authentication has been configured. We’ll check “Execute and wait” to wait for the workflow to complete. Click “Add Parameter” to add the text box for the “jenkinsParam1” vRO parameter.

Now that we’ve created the job we can test it out. Click “Build Now” to trigger the job.

If all went as expected the console output from our Jenkins job should show that the job and the workflow completed successfully.

Now we can jump to vRO and should see a successful run of our workflow. If we look at the logs of the run we should see the string from our Jenkins job in the log.

References

Jenkins vRO Plugin
https://wiki.jenkins-ci.org/display/JENKINS/VMware+vRealize+Orchestrator+Plugin