DevOPs,SVN,BITBucket,GIT (1)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Yes-M Systems - DevOps,SVN,BitBucket,GIT

DevOPs

DevOPs Process:

Development and Operations team work together in Devops.

The operations teams are then responsible for deploying and managing the
software with little-to-no direct interaction with the development teams

DevOps is not a tool , it is a methodology.

Why is DevOps Needed?

• Before DevOps, the development and operation team worked in complete


isolation.
• Testing and Deployment were isolated activities done after design-build.
Hence they consumed more time than actual build cycles.
• Without using DevOps, team members spend a large amount of their time
testing, deploying, and designing instead of building the project.
• Manual code deployment leads to human errors in production.
• Coding & operation teams have separate timelines and are not synch,
causing further delays.

There is a demand to increase the rate of software delivery by business


stakeholders. As per Forrester Consulting Study, Only 17% of teams can use
delivery software quickly, proving the pain point.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 1


Yes-M Systems - DevOps,SVN,BitBucket,GIT

DevOps Lifecycle: Key Components


Here are some important DevOps Lifecycle phases / Key components of DevOps:

DevOps
Lifecycle Diagram

Stage 1) Continuous Development


This practice spans the planning and coding phases of the DevOps lifecycle.
Version-control mechanisms might be involved.

This phase involves the planning and coding of the software. The vision of the
project is decided during the planning phase. And the developers begin developing
the code for the application. There are no DevOps tools that are required for
planning, but there are several tools for maintaining the code.

Stage 2) Continuous Integration


This software engineering practice develops software by frequently integrating its
components. It helps to ensure that changes in the source code do not break the
build or cause other problems.

This stage is the heart of the entire DevOps lifecycle. It is a software development
practice in which the developers require to commit changes to the source code
more frequently. This may be on a daily or weekly basis. Then every commit is
built, and this allows early detection of problems if they are present. Building code
is not only involved compilation, but it also includes unit testing, integration
testing, code review, and packaging.

The code supporting new functionality is continuously integrated with the existing
code. Therefore, there is continuous development of software. The updated code
needs to be integrated continuously and smoothly with the systems to reflect
changes to the end-users.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 2


Yes-M Systems - DevOps,SVN,BitBucket,GIT

Jenkins is a popular tool used in this phase. Whenever there is a change in the Git
repository, then Jenkins fetches the updated code and prepares a build of that
code, which is an executable file in the form of war or jar. Then this build is
forwarded to the test server or the production server.

Stage 3) Continuous Testing


This DevOps lifecycle stage incorporates automated, prescheduled, continued code
tests as application code is written or updated. Such tests can be written manually
or in conjunction with continuous integration tools.

This phase, where the developed software is continuously testing for bugs. For
constant testing, automation testing tools such as TestNG, JUnit, Selenium, etc
are used. These tools allow QAs to test multiple code-bases thoroughly in parallel
to ensure that there is no flaw in the functionality.

Selenium does the automation testing, and TestNG generates the reports. This
entire testing phase can automate with the help of a Continuous Integration tool
called Jenkins.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 3


Yes-M Systems - DevOps,SVN,BitBucket,GIT

Automation testing saves a lot of time and effort for executing the tests instead of
doing this manually. Apart from that, report generation is a big plus. The task of
evaluating the test cases that failed in a test suite gets simpler. Also, we can
schedule the execution of the test cases at predefined times. After testing, the
code is continuously integrated with the existing code.

01:

Stage 4) Continuous Deployment


The deployment process takes place continuously in this DevOps lifecycle phase.In
this phase, the code is deployed to the production servers. Also, it is essential to
ensure that the code is correctly used on all the servers.

The new code is deployed continuously, and configuration management tools play
an essential role in executing tasks frequently and quickly. Here are some popular
tools which are used in this phase, such as Chef, Puppet, Ansible, and SaltStack.

Stage 5) Continuous Monitoring


During this phase, developers collect data, monitor each function, and spot errors
like low memory or server connection are broken. For example, when users log in,
they should access their account, and a failure to do so means there’s a problem
with your application.

Monitoring is a phase that involves all the operational factors of the entire DevOps
process, where important information about the use of the software is recorded
and carefully processed to find out trends and identify problem areas. Usually, the
monitoring is integrated within the operational capabilities of the software
application.

It may occur in the form of documentation files or maybe produce large-scale data
about the application parameters when it is in a continuous use position. The
system errors such as server not reachable, low memory, etc are resolved in this
phase. It maintains the security and availability of the service.

Stage 6) Continuous Feedback


Continuous feedback is like a progress report. In this DevOps stage, the software
automatically sends out information about performance and issues experienced by
the end-user. It’s also an opportunity for customers to share their experiences and
provide feedback.

he application development is consistently improved by analyzing the results from


the operations of the software. This is carried out by placing the critical phase of
constant feedback between the operations and the development of the next
version of the current software application.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 4


Yes-M Systems - DevOps,SVN,BitBucket,GIT

The continuity is the essential factor in the DevOps as it removes the unnecessary
steps which are required to take a software application from development, using it
to find out its issues and then producing a better version. It kills the efficiency that
may be possible with the app and reduce the number of interested customers.

Stage 7) Continuous Operations


It is the last, shortest, and most straightforward phase of DevOps. It also involves
automating the application’s release and all these updates that help you keep
cycles short and give developers and provide more time to focus on developing.

All DevOps operations are based on the continuity with complete automation of
the release process and allow the organization to accelerate the overall time to
market continuingly.

It is clear from the discussion that continuity is the critical factor in the DevOps in
removing steps that often distract the development, take it longer to detect issues
and produce a better version of the product after several months. With DevOps,
we can make any software product more efficient and increase the overall count
of interested customers in your product.

SVN: SubVersion:

Version Control system is a software that helps developers to work together and
maintain a complete history of their work.

Subversion falls under centralized version control system, meaning that it uses
central server to store all files and enables team collaboration.

Version Control Terminologies

Repository: A repository is the heart of any version control system. It is the central
place where developers store all their work. Repository not only stores files but
also the history. Repository is accessed over a network, acting as a server and
version control tool acting as a client. Clients can connect to the repository, and
then they can store/retrieve their changes to/from repository. By storing changes,
a client makes these changes available to other people and by retrieving changes,
a client takes other people’s changes as a working copy. •

Trunk: The trunk is a directory where all the main development happens and is
usually checked out by developers to work on the project. •

Tags: The tags directory is used to store named snapshots of the project. Tag
operation allows to give descriptive and memorable names to specific version in
the repository. For example, LAST_STABLE_CODE_BEFORE_EMAIL_SUPPORT is more

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 5


Yes-M Systems - DevOps,SVN,BitBucket,GIT

memorable than 1. BASIC CONCEPTS SVN 2 Repository UUID: 7ceef8cb-3799-40dd-


a067-c216ec2e5247 and Revision: 13 •

Branches: Branch operation is used to create another line of development. It is


useful when you want your development process to fork off into two different
directions. For example, when you release version 5.0, you might want to create a
branch so that development of 6.0 features can be kept separate from 5.0 bug-
fixes. •

• Commit changes: Commit is a process of storing changes from private workplace


to central server. After commit, changes are made available to all the team. Other
developers can retrieve these changes by updating their working copy. Commit is
an atomic operation. Either the whole commit succeeds or it is rolled back. Users
never see half finished commit

Step #1: For repository creation, go to the folder where the project is saved
and Right-click Tortoise SVN and choose ‘Create repository here’ option.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 6


Yes-M Systems - DevOps,SVN,BitBucket,GIT

Step #2: Repository creation is done successfully on the specified Path.

Step #3: We can see the icon change in framework (POM_Framework) creation.

Pushing The Framework Into Repository


Step #1: Right-click on Project and choose Team -> Share Project.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 7


Yes-M Systems - DevOps,SVN,BitBucket,GIT

Step #2: Choose SVN and click Next.

Step #3: Select ‘Create a new repository location’ and click Next.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 8


Yes-M Systems - DevOps,SVN,BitBucket,GIT

Step #4: Give the URL that you have given for repository creation and click
the Finish button.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 9


Yes-M Systems - DevOps,SVN,BitBucket,GIT

Step #5: We have successfully added our framework into the repository folder.

SVN Checkout
We are trying to checkout the project folder POM_Framework by following the
below steps.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 10


Yes-M Systems - DevOps,SVN,BitBucket,GIT

Step #1: Right-click outside the folder path and choose SVN Checkout.

Step #2: Choose the repository path and click OK.

Step #3: The project folder is successfully checked out in the mentioned path and
it automatically sets the revision number.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 11


Yes-M Systems - DevOps,SVN,BitBucket,GIT

Commit: The below piece of code has been added in the LoginTests.java file and
we are trying to commit it in the repository.
Source Code:
Package com..Tests;

Public class LoginTests {

Public static void main(String args[])

WebDriver driver = new FirefoxDriver();

driver.get("file:///E://Selenium%20Programs/mypage.html");

WebElement txtFirstName = driver.findElement(By.id("txtfirstname"));

txtFirstName.sendKeys("jsmith");

WebElement txtLastName = driver.findElement(By.name("txtLastname"));

txtLastName.sendKeys("tester");

WebElement txtPassword = driver.findElement(By.className("pi"));

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 12


Yes-M Systems - DevOps,SVN,BitBucket,GIT

txtPassword.sendKeys("testpassword");

driver.findElement(By.tagName("a")).click();

driver.navigate().back()

Step #1: Right-Click the project and select Team -> Commit.

Step #2: A dialog box as shown below will be displayed, just choose the file that
has been changed by the user. Enter the comments in the text box, ‘What we
added/changed/Deleted’.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 13


Yes-M Systems - DevOps,SVN,BitBucket,GIT

Step #3: Now the file/folder is successfully checking in to the repository.

Why Do You Need SVN?


Suppose you are in the process of developing a Selenium automation project. Let
us say there are three team members working on this project: Tester A, Tester B,
Tester C.

Now assume, there are 15 automation test scripts that need to be written. So
these three teammates decide to divide five scripts each amongst themselves and
start automating them. Now, in the end, they will all merge their code and the
final code will be built. The Blue circular shape in the figures below represents the
final merged code.

If ‘Tester A’ decides to make some correction in his piece of code, then he will
have to get the whole merged code into his local workspace so that he can correct
it as shown in the below figure. Workspace means a simple Selenium project.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 14


Yes-M Systems - DevOps,SVN,BitBucket,GIT

Similarly ‘Tester B’ will also have to get the whole code into his workspace if he
wants to make any changes to his/her test cases.

But the problem that will arise is that each and everyone will now have a different
version of the workspace. The changes that ‘Tester A’ has done in his workspace,
will not be present in the workspace that ‘Tester B’ has as shown below. There
will be no synchronization of workspaces between the team members.

If a new team member joins and he wants to set up his local workspace, then there
will be conflict about which Tester should give him his workspace? Thus, there will
be confusion. Here, we are talking about three testers, what if you are working on
a big automation project comprising of many testers?

Hence, to resolve these code synchronization issues and to ensure that everyone in
the team is on the same page, we use Subversion SVN.

There are many other tools in the market that help in source code management.
Few are free (open source) like CVS (Concurrent Versioning System), RCS (Revision
Control System), Git. While a few are licensed like Rational ClearCase.

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 15


Yes-M Systems - DevOps,SVN,BitBucket,GIT

BitBucket:

Git commands

Task Git commands


Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 16
Yes-M Systems - DevOps,SVN,BitBucket,GIT

Create a new local directory: git init

Connect your local repository to a remote server: git remote add origin
<server_URL>

Copy a remote repository to your local system: git clone <URL_to_repository>

Add a specific file to staging (Git) or after a new file is created git add <filename>
(Hg):

Add all changes to staging (Git) or all new files (Hg): git add --all

Commit changes locally: git commit -m '<message>'

Push changes to your remote repository: git push <remote_name>


<branch_name>

usually: git push origin master

List the status of the files you've changed and those you still git status
need to add or commit:

List all the branches/bookmarks in your repo with an indication git branch
of the one you are on:

Push the branch/bookmark to your remote repository: git push origin <branch_name>

Fetch and merge changes on the remote server to your working git pull
directory:

Merge two different revisions into one: git merge

Show all changes made since the last commit: git diff

Yes-M Systems LLC, http://myyesm.com DevOps,SVN,BitBucket,GIT Page 17

You might also like