DevOps,  VMWARE

vRealize Automation 8 Code Stream – Part 2 Create Pipeline for Jenkins CI/CD Job with Git.

vRealize Automation 8 Code Stream – Part 2 Create Pipeline for Jenkins CI/CD Job with Git.

In part 1 of this blog series, I covered how to create vRealize Automation Code Stream Endpoint for Jenkins Server.

In this 2nd part of the blog series, I will cover how to create vRealize Automation Code Stream Pipeline with Jenkins for CI/CD with Git as Source Code Management.

vRealize Automation Code Stream Introduction –

You will find more information about vRA Code Stream in VMware Docs.

However, a high level, vRealize Automation Code Stream models the tasks in your software release process and automates the development and test of developer code to release it to production.

It integrates your release process with developer tools to accomplish specific tasks and tracks all code artefacts and versions.

You can use the vRealize Automation Code Stream with other vRealize Automation components.

  • Deploy a vRealize Automation Cloud Assembly blueprint, and use the parameter values that the blueprint exposes.
  • Publish your pipeline to vRealize Automation Service Broker so that other members of your team can request and deploy it to their cloud regions.

I will be using vRA 8 Code Stream to create an endpoint and pipeline that runs specif actions like Build & Deploy my code which is available as part of Jenkins Job.

Prerequisites –

  • Set up a Jenkins server that runs version 1.561 or later.
  • Verify that you are a member of a project in vRealize Automation Code Stream.
  • Verify that a job exists on the Jenkins server so that your pipeline task can run it.

My Lab Setup –

Following DevOps tools are used as part of this demo.

  1. Git – Source Code Management.
  2. Jenkins – To create CI/CD Pipeline.
  3. Ansible – As configuration management & deployment.
  4. Docker/Kubernetes – As a target environment to deploy the Artifacts.

Here is the flow that we will see –

I have a basic JSP webapp code, we will update this code in my Laptop or Unix Client and will push updated code into Git Repository.

Git is a source code management system here. Whenever the code is available in Git, Jenkins pull that code and do the build.

Once the build created, it generates artefacts. These Artifacts should be deployed into the target environment.

I have Docker/Kubernetes environment here as a target environment. You could use Containers, Kubernetes Clusters, or VMs as a target environment.

We will need a tool to deploy the artefacts into the target environment and therefore I am using Ansible to deploy the artefacts on Docker/Kubernetes environment.

Let’s start with Pipeline configuration –

Log in to the vRealize Automation UI console and select Code Stream from Landing Page.

Here, we will vRealize Automation Code Stream Pipeline for Jenkins Jobs.

I will provide a name for the new Pipeline and associate it with the relevant Project in my vRA8 environment.

When you are creating a Pipeline, a ‘Blank Canvas’ will appear.

Select the default stage and enter the name for the task in the Task area. I have named this task as the ‘Build’ Task.

Select the task type as Jenkins and select the Jenkins endpoint that you created.

From the drop-down menu, select a job from the Jenkins server that your pipeline will run.

Execute ‘VALIDATE TASK’ in order to validate Pipeline creation.

Similarly, I have created another task and named it as ‘Test’.

Assign a name to the Pipeline stage.

Next, I should enable the Pipeline in order to use it.

Now I will run the Pipeline and verify if Jenkins Job executes successfully.

Noticed, vRealize Automation Code Stream Pipeline that we executed has triggered Jenkins Job to Build and Deploy my Code on Container in my target environment.

This is where Jenkins pull the updated code from the Git repository and do the build.

Once the Build is done, artifacts (.WAR file) are created and then Jenkins uses Ansible to deploy the artifacts to the target environment.

I will further drill down to the logs of my Jenkins job to verify the execution.

I can see the vRealize Automation Code Stream Pipeline status as completed successfully.

Here is the webapp (simple web page) that was successfully deployed as part of Jenkins Job.

In the next part of the Blog series, I will update the basic web page code on my Laptop/Client and push it to Git.

We will then run the same vRealize Automation Code Stream Pipeline to see how the updated code reflected on our web page as part of the CI/CD operation.

Disclaimer: the code is just a normal web page and not a fancy HTML. This is used to showcase a simple demo.

 

Hope you enjoyed this post, I’d be very grateful if you’d help to share it on Social Media. Thank you!