Monday, July 20, 2020

CI CD Pipeline - how to Setup a CI CD Pipeline from Scratch

What is CI/CD?

Continuous integration (CI) and continuous delivery (CD) is collection of practices that enable application development teams to deliver code changes more frequently and reliably. CI/CD is one of the best practices for devOps teams to implement. It is also an agile methodology best practice, as it enables software development teams to focus on meeting business requirements, code quality, and security because deployment steps are automated. The implementation is also known as the CI/CD pipeline. 

CI CD Pipeline implementation or the Continuous Integration/Continuous Deployment software is the backbone of the modern DevOps environment. CI/CD bridges the gap between development and operations teams by automating build, test and deployment of applications.

Before moving onto the CI CD pipeline’s working, let’s start by understanding DevOps.

What is DevOps?

DevOps is a software development approach which involves continuous development, continuous testing, continuous integration, continuous deployment and continuous monitoring of the software throughout its development life cycle. This is exactly the process adopted by all the top companies to develop high-quality software and shorter development life cycles, resulting in greater customer satisfaction, something that every company wants.


What is CI CD Pipeline?
CI stands for Continuous Integration and CD stands for Continuous Delivery and Continuous Deployment. You can think of it as a process which is similar to a software development lifecycle.

Now let us see how does it work.


The above pipeline is a logical demonstration of how a software will move along the various phases or stages in this lifecycle, before it is delivered to the customer or before it is live on production. 

Let’s take a scenario of CI CD Pipeline. Imagine you’re going to build a web application which is going to be deployed on live web servers. You will have a set of developers who are responsible for writing the code which will further go on and build the web application. Now, when this code is committed into a version control system(such as git, svn) by the team of developers. Next, it goes through the build phase which is the first phase of the pipeline, where developers put in their code and then again code goes to the version control system having a proper version tag.

Suppose we have a Java code and it needs to be compiled before execution. So, through the version control phase, it again goes to build phase where it gets compiled. You get all the features of that code from various branches of the repository, which merge them and finally use a compiler to compile it. This whole process is called the build phase.

Testing Phase:
Once the build phase is over, then you move on to the testing phase. In this phase, we have various kinds of testing, one of them is the unit test (where you test the chunk/unit of software or for its sanity test).

Deploy Phase:
When the test is completed, you move on to the deploy phase, where you deploy it into a staging or a test server. Here, you can view the code or you can view the app in a simulator.


Auto Test Phase:
Once the code is deployed successfully, you can run another set of a sanity test. If everything is accepted, then it can be deployed to production.


Deploy to Production:
Meanwhile in every step, if there is some error, you can shoot a mail back to the development team so that they can fix them. Then they will push it into the version control system and goes back into the pipeline.

Once again if there is any error reported during testing, again the feedback goes to the dev team where they fix it and the process re-iterates if required.


Measure+Validate:
So, this lifecycle continues until we get a code or a product which can be deployed in the production server where we measure and validate the code.


We have understood CI CD Pipeline and its working, now we will move on to understand what Jenkins is and how we can deploy the demonstrated code using Jenkins and automate the entire process.

Jenkins – The Ultimate CI Tool and Its Importance in CI CD Pipeline

Our task is to automate the entire process, from the time the development team gives us the code and commits it to the time we get it into production.

Our task is to automate the pipeline in order to make the entire software development lifecycle on the dev-ops mode/ automated mode. For this, they would need automation tools.


Jenkins provides us with various interfaces and tools in order to automate the entire process.

So what happens, we have a git repository where the development team will commit the code. Then Jenkins takes over from there which is front-end tool where you can define your entire job or the task. Our job is to ensure the continuous integration and delivery process for that particular tool or for the particular application. 

From Git, Jenkins pulls the code and then moves it to the commit phase, where the code is committed from every branch. Then Jenkins moves it into the build phase where we compile the code. If it is Java code, we use tools like maven in Jenkins and then compile that code, which we can be deployed to run a series of tests. These test cases are overseen by Jenkins again.

Then it moves on to the staging server to deploy it using docker. After a series of Unit Tests or sanity test, it moves to the production.

This is how the delivery phase is taken care by a tool called Jenkins, which automate everything. Now in order to deploy it, we will need an environment which will replicate the production environment, I.e., Docker.

Docker:

Docker is just like a virtual environment in which we can create a server. It takes a few seconds to create an entire server and deploy the artifacts which we want to test. But here the question arises,


Why do we use docker? 

As said earlier, you can run the entire cluster in a few seconds. We have storage registry for images where you build your image and store it forever. You can use it anytime on any environment which can replicate itself. 

Unlike my other blogs, this one is having information mostly from the below Reference website.

Tuesday, June 16, 2020

The BlazeMeter Chrome Extension : Record JMeter, Selenium, or Synchronized JMeter and Selenium

The BlazeMeter Chrome Extension:

The BlazeMeter chrome extension is a free tool that enables you to Record, Browse, Upload, and Run your testing scripts. The Chrome Extension supports recording JMX, JSON or YML files, for running in JMeter, Taurus or BlazeMeter as well as both JMeter and Selenium scripts, automatically and simultaneously.


Running Your JMeter and Selenium Script in BlazeMeter:

The new BlazeMeter Chrome extension records all of the HTTP/S requests that your browser sends, creates a JMeter or Selenium script, and uploads it to Blazemeter, where you can execute it with a single click.

In other words, you can run a JMeter and Selenium without even having them installed. There is no need to install JMeter or Selenium to record or run a performance test; the Chrome extension creates the script on its own.

Running Your JMeter and Selenium Script Locally:

On the other hand, if you have JMeter installed, you can convert your recording into a JMeter JMX file or Taurus YAML file, then edit or run it via your browser or on your local computer.  

Note: The extension needs to be able to communicate with blazemeter.com in order for the recording to be converted into a script.

Using the BlazeMeter Chrome Extension:

1. Add Blazemeter Chrome Extension on your local computer

2. Record your actions, then play them back as a script

How to Add Blazemeter Chrome Extension on your local computer

1. Open chrome browser, Click on chrome Apps




2. Click on web-store which is in Right-bottom


3. Search Blazemeter and click on Add extension




4. Now you can Login and see blazemeter on your chrome 



How to Record your actions, then play them back as a script

1.  Provide test name and click on recording button. And type website name whatever you want to test.


2. Save .jmx file on your local machine



3. Open Jmeter


4. Now, you can open your saved .jmx file in Jmeter 


5. Here you can see all http request and execute your performance testing and load testing


For more information you can follow below link :) 

Featured Posts