vRealize Automation 8 Code Stream – Part 3 Continuous Integration & Deployment
In part 1 of this blog series, I covered how to create vRealize Automation Code Stream Endpoint for Jenkins Server.
In part 2 of this blog series, we went through how to create vRealize Automation Code Stream Pipeline with Jenkins Jobs.
In this last part of the blog series, I will cover CI/CD for a webapp and run the vRA Code Stream Pipeline which will trigger Jenkins job in the backend that uses Git & Ansible.
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.
- Git – Source Code Management.
- Jenkins – To create CI/CD Pipeline.
- Ansible – As configuration management & deployment.
- 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 updating webapp code –
Now imagine, for some reason, I want to modify the code on his Client/Laptop.
My code location is as below.
I will update the code now.
After Code is updated. Push the code to Git Repository.
Now ‘Open’ the vRealize Automation Code Stream Pipeline to Build & Deploy updated WebApp.
BTW, you could ‘RUN’ it from here as well.
Verify the correct Pipeline, and click on ‘RUN’.
Note that Pipeline has been successfully executed and its currently running.
Under the hood, Jenkins shows a running Job in Build History. This is where Jenkins pull the updated code from the Git repository and do the build.
Once the Build is done, artefacts (.WAR file) are created and then Jenkins uses Ansible to deploy the artefacts to the target environment.
Jenkins build a history for the relevant Job shows successful completion of the Job.
vRealize Automation Code Stream Pipeline status shows completed successfully.
Have a look at Webpage now, the Webpage is updated as per the modification done in the code earlier.
Hope you enjoyed this post, I’d be very grateful if you’d help to share it on Social Media. Thank you!