Using Jenkins with vRealize Code Stream

Using Jenkins with vRealize Code Stream

May 9, 2016 2 By Eric Shanks

By now, we’re probably Jenkins experts. So lets see how we can use Jenkins with vRealize Code Stream. To give you a little background, vRealize Code Stream is a release automation solution that can be added to VMware’s vRealize Automation solution. It’s a nifty little tool that will let us deploy a server from blueprint, call some Jenkins jobs and deploy code from an artifactory repository. One of the best features is that you can build your release in stages and have gating rules between them so you can automate going from Development to UAT to Production or whatever else you can think of.

Jenkins Project Setup

To get started, lets begin with the Jenkins job itself. Here we’ll setup a new project and the only requirement for the job to be called from Code Stream is to have an input parameter of “vRCSTestExecutionId”. So We need to parameterize the project and add this variable.


Next, for my job, it requires me to pass a serverip address. This is used in a Selenium test on a website to ensure that the website is working properly.


The last part of my project is to execute a batch command which runs my Selenium job against the server IP address that is passed to the Jenkins project.



vRealize Code Stream Setup

Before we can build a code stream pipeline, we must do some initial setup. First, it requires installing a license on your vRA appliance to allow access to the product. After this, we need to go to the Administration tab of your vRealize Automation Tenant and add an endpoint for Jenkins. Add a new endpoint and select “Jenkins (Code Stream) as the Plug-in type. Click Next.


Give the new endpoint a name and a description. Click Next.


Give the Jenkins Instance a name, and enter login credentials that will have access to run your Jenkins code. Also be sure to enter the URL for your Jenkins server. Click Finish.


Build a Code Stream Pipeline

Now we can build our Code Stream pipeline. The screenshot below shows the pipeline that will be executed during my test. To describe whats happening, when it’s executed, the development stage will first deploy a server from blueprint. The next task in that stage is to run our Jenkins job that we setup above. After this there is a gate that requires a manual approval to go to the next stage, but this could always be an automatic gate based on the results of your Jenkins job. Then when the Production stage kicks off, it deploys a new web server. The idea here is that we automatically deploy to development for testing and if its successful, then we can automatically deploy to production.


To give you some more detail, the configuration of WebServer task finds a blueprint that we’ve specified and request it. In my case it’s a blueprint called WebServer-Git which deploy a CentOS server, installs apache and downloads my web server files through GIT.
The next task is the Jenkins task. Here we choose the endpoint from the dropdown and select our Jenkins endpoint. After that select the job from the list. Remember that the only jobs that will be available in this list are the ones with the vRCSTestExecutionId as a input parameter. After you select the job, the Code Stream task will enumerate the input parameters so that you can enter in the appropriate values. Here I need to add the server ip address that was built in the previous task. To do that I can use the output attributes from the build task.



Now that all of the pieces are setup, you can run your pipeline and have machines deployed and tested with Jenkins before moving on to another environment like UAT or Production. Keep an eye on your release pipelines to see if your code is working and being deployed in a brand new environment each time.