Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
42 views84 pages

Devops

The document certifies that Nagothi Madhu Manasa has completed 10 experiments in the DevOps Lab as part of their BTECH program at Anil Neerukonda Institute of Technology and Science. It outlines the prerequisites, course outcomes, objectives, and hardware/software requirements for the DevOps Lab, along with detailed experiments and an introduction to DevOps and Git. The document also includes installation instructions for Git on Windows and Ubuntu, as well as basic Git commands.

Uploaded by

varshaa.kollu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views84 pages

Devops

The document certifies that Nagothi Madhu Manasa has completed 10 experiments in the DevOps Lab as part of their BTECH program at Anil Neerukonda Institute of Technology and Science. It outlines the prerequisites, course outcomes, objectives, and hardware/software requirements for the DevOps Lab, along with detailed experiments and an introduction to DevOps and Git. The document also includes installation instructions for Git on Windows and Ubuntu, as well as basic Git commands.

Uploaded by

varshaa.kollu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 84

ANIL NEERUKONDA INSTITUTE OF TECHNOLOGY AND SCIENCE

(Autonomous) (Approved by AICTE and Accredited by NBA & NAAC


with ‘A+’ Grade)
Sangivalasa-531162, Bheemunipatnam Mandal, Visakhapatnam
District (A.P)

CERTIFICATE

This is to certify that Nagothi Madhu Manasa is a student

studying 3/4 -A BTECH Semester 2 register number A22126511039

branch Information Technology has done the 10 number of

experiments during the year in the subject DevOps Lab.

1
DevOps Lab Manual
Information Technology

Prerequisite(s): Operating System, Virtualization, Cloud Computing, Java and Web Programming,
and Software Engineering & Monitor the Software Applications.

Course Outcomes:

Students will be able to:

CO 1: Remember the importance of DevOps tools used in software development life cycle

CO 2: Analyse & Illustrate the Containerization of OS images and deployment of applications over
Docker

CO 3: Summarize and Synthesize the importance of Software Configuration Management in


DevOpsusing Chef/Puppet/Ansible or Saltstack
Course Objectives:

DevOps improves collaboration and productivity by automating infrastructure and workflows


and continuously measuring applications performance.
Mapping of Course Outcomes with POs and PSO

COs/POs PO PO PO PO PO PO PO PO PO PO PO PO PSO PSO


PSOs 1 2 3 4 5 6 7 8 9 10 11 12 1 2
CO1 2 2 3 1 3 1 1 1 2 1 1 3 2
CO2 2 3 3 3 3 2 1 1 2 1 1 3 2
CO3 1 3 3 3 3 2 1 1 2 1 1 3 2

Hardware & Software Requirements:

PC With following Configuration

1. Windows or Linux Desktop OS for Client machines

2. Internet Connection for each PC with at least 2 MBPS

3. Intel Core i3/i5/i7 Processor with Intel VT-X support

4. 8 GB RAM Minimum 5. 500 GB Hard Disk

6. Gigabit Ethernet (GbE) network interface card (NIC CentOS/Fedora/Ubuntu/Redhat Server OS for
One Server)

7. JDK or higher
8. Netbeans or Eclipse

2
9. OpenSSH.

10. List of Software‘s - Maven, Jenkins

Experiments:

SR. Detailed Content CO DATE GRADE SIGNATURE


NO Mapping
1 To Understand the Concept of
DevOps with related technologies
which are used to Code, Build, CO 1 06-01-2025
Test, Configure & Monitor the
Software Applications.
2 To Perform Version Control on CO 1 20-01-2025
websites/ Softwares using different
Version control tools like RCS/ CO 1 27-01-2025
CVS/GIT/Mercurial (Any two) and to
implement Bit Bucket.
3 To Install and Configure Jenkins to CO 1 03-02-2025
test, and deploy Java or Web
Applications using Netbeans or CO 3 10-02-2025
eclipse. Introduction to Maven and To
create maven project.
4 To Install and Configure Docker for CO 1 17-02-2025
creating Containers of different CO 3 24-02-2025
Operating System Images
5 To Build, deploy and manage web CO 1 03-03-2025
or Java , python and html CO 3 10-03-2025
applications on Docker
6 To install and configure Software CO 1
Configuration Management using 22-03-2025
Chef/Puppet/Ansible or Saltstack CO 3
7 To Perform Software Configuration CO 1
Management and provisioning 24-03-2025
usingChef/ Puppet/ Ansible or CO 3
Saltstack.

3
Week – 1 Introduction

to DevOps

AIM:
To Understand the Concept of DevOps with related technologies which are used to Code, Build, Test,
Configure & Monitor the Software Applications.

THEORY:

What is DevOps:

The word DevOps is a combination of two words Development and Operations. Before getting
into what DevOps is, let us get an idea about the two teams involved in software development.
The development team is responsible for developing, designing, and building the application.
The operation team deals with the deployment and testing of the application. If there are
problems with the application, the operation team also provides feedback to the development
team. Now let us get to the history of DevOps.
History of DevOps:

Let us see some important events of DevOps :

2007-2008: The DevOps idea was started

2009: In the initial stage the first conference was ”Deploys a day: Dev and Ops cooperation of
flicker.” Another conference called “DevOps Days in Ghent, Belgium” also happened.

2010: DevOps days conference happened in the United States at mount view, calif.

2012: Allana browns at puppet creates a state of DevOps report

2014: Publishing the annual “State of DevOps report”

2017: Forrester Research calls 2017 “The Year of DevOps”

2018: 30 DevOps day conferences were scheduled across the united states.

Need of DevOps:

As we know about the problems faced in traditional models like in the waterfall model there is
a problem of a one-way stream of work. Due to which if there is any mistake the whole process
repeats and there is no interaction with customers. Now, this is solved in agile by splitting the
whole development plan into several iterations for a better level of production efficiency. The
agile model also includes customer interaction with the company to rectify the mistakes. But
there is another problem faced in Agile too.
Here, the problem arises when the development team continuously changes the code for better
performance and sends the code to the operations team for testing. But there may be a delay in

4
the operations team feedback in situations like if the developers sent code for review at night
but due to the unavailability of the operations team, there will be a delay in the project feedback.

So, DevOps is the solution to this problem. DevOps is a practice or a methodology in which the
development team and operations team work together by including automation at the initial
stages. So they can work on rapidly changing systems, fix bugs, and help to deliver a good quality
of software in time.

DevOps Architecture:

Development and operations both play essential roles in order to deliver applications. The
deployment comprises analysing the requirements, designing, developing, and testing of the
software components or frameworks.

The operation consists of the administrative processes, services, and support for the software.
When both the development and operations are combined with collaborating, then the DevOps
architecture is the solution to fix the gap between deployment and operation terms; therefore,
delivery can be faster.

DevOps architecture is used for the applications hosted on the cloud platform and large
distributed applications. Agile Development is used in the DevOps architecture so that
integration and delivery can be contiguous. When the development and operations team works
separately from each other, then it is time-consuming to design, test, and deploy. And if the
terms are not in sync with each other, then it may cause a delay in the delivery. So, DevOps
enables the teams to change their shortcomings and increases productivity.
Below are the various components that are used in the DevOps architecture:

5
1.) Build:
Without DevOps, the cost of the consumption of the resources was evaluated based on the pre -
defined individual usage with fixed hardware allocation. And with DevOps, the usage of cloud, sharing
of resources comes into the picture, and the build is dependent upon the user's need, which is a
mechanism to control the usage of resources or capacity

2.) Code:

Many good practices such as Git enables the code to be used, which ensur es writing the code
for business, helps to track changes, getting notified about the reason behind the difference in
the actual and the expected output, and if necessary reverting to the original code developed.
The code can be appropriately arranged in files, folders, etc. And they can be reused.

3.) Test:

The application will be ready for production after testing. In the case manual testing, it
consumes more time in testing and moving the code to the output. The testing can be
automated, which decreases the time for testing so that the time to deploy the code to
production can be reduced as automating the running of the scripts will remove many manual
steps.
4.) Plan:

DevOps use Agile methodology to plan the development. With the operations and development team
in sync, it helps in organizing the work to plan accordingly to increase productivity.

5.) Monitor:

6
Continuous monitoring is used to identify any risk of failure. Also, it helps in tracking the system
accurately so that the health of the application can be checked. The monitoring becomes more
comfortable with services where the log data may get monitored through many third-party tools
such as Splunk.

6.) Deploy:

Many systems can support the scheduler for automated deployment. The cloud management
platform enables users to capture accurate insights and view the optimization scenario, analytics
on trends by the deployment of dashboards.

7.) Operate:

DevOps changes the way traditional approach of developing and testing separately. The teams
operate in a collaborative way where both the teams actively participate throughout the service
lifecycle. The operation team interacts with developers, and they come up with a monitoring
plan which serves the IT and business requirements.

8.) Release:

Deployment to an environment can be done by automation. But when the deployment is made
to the production environment, it is done by manual triggering. Many processes involved in
release management commonly used to do the deployment in the production environment
manually to lessen the impact on the customers.

7
Week – 2

Introduction to GIT

What is GIT:

Git is a popular version control system. It was created by Linus Torvalds in 2005, and has been
maintained by Junio Hamano since then.

It is used for:

• Tracking code changes


• Tracking who made changes
• Coding collaboration

What does GIT do:

• Manage projects with Repositories


• Clone a project to work on a local copy
• Control and track changes with Staging and Committing
• Branch and Merge to allow for work on different parts and versions of a project
• Pull the latest version of the project to a local copy
• Push local updates to the main project

Working with GIT:

• Initialize Git on a folder, making it a Repository


• Git now creates a hidden folder to keep track of changes in that folder
• When a file is changed, added or deleted, it is considered modified
• You select the modified files you want to Stage
• The Staged files are Committed, which prompts Git to store a permanent snapshot of the files
• Git allows you to see the full history of every commit.
• You can revert back to any previous commit.
• Git does not store a separate copy of every file in every commit, but keeps track of changes
made in each commit!

Why GIT ?

• Over 70% of developers use Git!


• Developers can work together from anywhere in the world.
• Developers can see the full history of the project.
• Developers can revert to earlier versions of a project.

What is GitHub ?

• Git is not the same as GitHub.

8
• GitHub makes tools that use Git.
• GitHub is the largest host of source code in the world, and has been owned by Microsoft since
2018.
• In this tutorial, we will focus on using Git with GitHub.

Installation of GIT in Windows

Step 1: To download the Git installer, visit the Git’s official site and go to download page

The link for download page is https://git-scm.com/download

Click on the package given on the pages as latest version for windows. The download will start after
selecting the package.

Now, the GIT installer package has been downloaded

Step 2: Click on the downloaded installer file and select yes to continue. After selecting the yes the
installation begins, and the screen will look like as:

Click on next to continue.

Step3: Default components are automatically selected in this step. You can also choose your required
part.

Click next to continue

Step4: The default Git command-line options are selected automatically. You can choose your preferred choice.

Click next to continue.

Step5: The default transport backend options are selected in this step. Click next to continue.

Step 6: Select your required line ending option

Click next to continue.

Step7: Select preferred terminal emulator clicks on the next to continue.

Step8: This is the last step that provides some extra features like system caching, credential
management and symbolic link. Select the required features and click on the next option.

Step9: The files are being extracted in this step.

Therefore, The Git installation is completed. Now you can access the Git Gui and Git Bash.

The Git Gui looks like as:

9
It facilitates with three features.

• Create New Repository


• Clone Existing Repositor y
• Open Existing Repository

The Git Bash looks like as

Installation of GIT in Ubuntu

• Git is an open-source distributed version control system that is available for


everyone at zero cost. It is designed to handle minor to major projects with speed
and efficiency. It is developed to co-ordinate the work among programmers. The
version control allows you to track and work together with your team members at
the same workspace.
• Git is the most common source code management (SCM) and covers more users
than earlier VCS systems like SVN. Let's understand how to install Git on your Ubuntu
server.

10
Step1: Start the General OS and Package update

First of all, we should start the general OS and package updates. To do so, run the below command:

$ apt-get update

Now we have started the general OS and package updates. After this, we will run the general
updates on the server so that we can get started with installing Git. To do so, run the following
commands:

Step2: Install Git

To install Git, run the below command:

$ apt-get install git-core

The above command will install the Git on your system, but it may ask you to confirm the download
and installation.

Step3: Confirm Git the installation

To confirm the installation, press 'y' key on the editor. Now, Git is installed and ready to use.

When the central installation done, first check to ensure the executable file is set up and accessible.
The best way to do this is the git version command. It will be run as:

$ git --version

Output:

Step 4: Configure the Git for the First use

Now you can start using Git on your system. You can explore many features f the version control
system. To go with Git, you have to configure the initial user access process. It can be done with
the git config command.

Suppose I want to register a us er whose user name is "vishnupriya9141" and email address is
" [email protected] m ", then it will be done as follows:
To register a username, run the below command:

$ git config --global user.name "vishnupriya9141"

11
To register an email address for the given author, run the below command:

$ git config --global user.email "[email protected]"

Now, you have successfully registered a user for the version control system.

It's important to understand that the git config tool works on a user according to the user. For
example, if we have a user "john" registered on Git. Then there can be another user "Mike" on
the same machine registered on Git. To do this, Mike must run the same command from his user
account. The commits made by both the users will be done under their details in
Git.

GitHub commands

Getting and Creating Projects

Command Description

git init Initialize a local Git repository


gitclone Create a local copy of a remote
ssh://[email protected]/[username]/[repository- repository
name].git
Basic Snapshotting

Command Description

git status Check status

git add [file-name.txt] Add a file to the staging area


git add –A Add all new and changed files to the
staging area
git commit -m "[commit message]" Commit changes
git rm -r [file-name.txt] Remove a file (or folder)

Branching and Merging

Command Description
git branch List branches (the asterisk denotes the
current branch)
git branch –a List all branches (local and remote)
git branch [branch name] Create a new branch
git branch -d [branch name] Delete a branch

12
git push origin --delete [branch name] Delete a remote branch
git checkout -b [branch name] Create a new branch and switch to it
git checkout -b [branch name] Clone a remote branch and switch to it
origin/[branch name]
git branch -m [old branch name] [new Rename a local branch
branch name]
git checkout [branch name] Switch to a branch
git checkout - Switch to the branch last checked out
git checkout -- [file-name.txt] Discard changes to a file

git merge [branch name] Merge a branch into the active branch
git merge [source branch] [target branch] Merge a branch into a target branch
git stash Stash changes in a dirty working directory
git stash clear Remove all stashed entries

Inspection and Comparison

Command Description
git log View changes
git log --summary View changes (detailed)
git log –one line View changes (briefly)
git diff [source branch] [target branch] Preview changes before merging

13
a) AIM:

To perform version control on website software using different version control tools like GIT

Theory:

To generate SSH key:


Step 1: Open visual studio, GIT account to clone the files

Step 2: Open the new folder in visual studio and open the terminal (Git Bash).

Step 3: To generate SSH key (Server Shell Key) for authentication purpose give the following command.

Step 4: Open GIT command prompt for i.e., Git Bash


Enter

ssh-keygen -t rsa -b 4096 -C”[email protected]” Generating

public/private rsa keypair

Enter file name to save the key:

Enter passphrase:

Enter same passphrase again:

Your identification key has been saved in

"C:\Users\hp272 pavilion\.ssh\id_rsa"

14
Your public key has been saved in

“C:\Users\hp272 pavilion\.ssh\id-rsa.pub”

Step 5: Goto public key location and Copy the public key.

Step 6: Now, Go to Git Hub account,go to setting and select SSH key and paste SSH key and save
.

15
Step 7: Now, go to Git Bash and set up global config variables (if we are working with other developers we
need to know who is checking whole code in and out, and to make the changes.
$git config –global user.name “vishnupriya9141”

$git config –global user.email “[email protected]

Clone project

Step 1: Open GIT Bash and type the following command+

$git clone [email protected]:vishnupriya9141/examples.git

Step 2: To make changes in repository or add new file local machine give the following $git
add “hello.py”

16
Or $git add

Step 3: To commit changes type the following command

$git commit -m “commited”

Step 4: To push the file from local machine to git to give the following command:

17
$git push

b) AIM:

To commit and push project from eclipse IDE to GIT and GIT to eclipse IDE.

PROCEDURE:

Step 1: Open eclipse IDE.

Step 2: Open perspective and then select GIT.

Step 3: Select Clone a GIT repository

Step 4: Copy the SSH URI of project repository in github and paste it in URI. (For http URI usename
and password need to be given) and click on Next.

Step 5: Select Branch and click on Next.

18
Step 6: Select Local Destination and click on Finish.

Step 7: Now, In Eclipse IDE GIT repo

sitories
appears as follow

Step 8: Now, Create a Java project, Enter Project name, and click on Finish
20
Step 9: Now, right click on Project name goto Team and then goto Share Project

Step 10: Now, configure the GIT Repository and click on Finish.

Step 11: Again right click on project and goto Team and (Now you will be shown many options)
goto Commit.

2
Step 12: Now, drag the Unstaged changes to Staged changes and write a Commit Message and
click on Commit and Push.

Step 13: Now, you get a message as follow click on close.

Step 14: Now, Refresh the GitHub page to see changes.

2
Step 15: Now, click on SRC goto New goto Class.

Step 16: Enter package name and Class name and click on Finish.

Step 17: Type the program and drag the Unstaged changes to Staged changes and write a Commit Message
and click on Commit and Push.

Step 18: Refresh the GitHub to see changes.

2
c) Aim:
To implement Bit Bucket

Procedure:

2
Step-1: Go to “bitbucket.org” and register.

Step-2: Click on “Get Free” icon and set up a workspace.

Step-3: Create a new Repository and get ready to clone in VS CODE

Step-5: Select clone option and copy the “URL” and select open in VSCODE

Step-6: Install bitbucket extension in Vs Code and open a new folder and then open an integrated
terminal and paste the url with the following command
>git clone <URL>

Set up your App Password : Go to Personal Settings in bitbucket.org and select “Add App Passwords
“ and then copy the password generated by it and save it in your notepad
2
Step-7: After entering the Login Credentials Your repository is successfully cloned in your local VS
CODE

Step-8: Now create a new file “hello.java” and enter a sample java program and add the file to
repository

➢ Git add “hello.java”

➢ Git commit -m “ First Commit “

➢ Git push

2
Step-9: Now if we go back to our bitbucket Account and refresh the page we can see out hello.java
file successfully added and we can apply our required operations.

Output :-

2
Week – 3

Introduction to Jenkins

What is Jenkins and Why we use it ?

Jenkins is an open-source automation tool written in Java with plugins built f or Continuous

Integration purposes. Jenkins is used to build and test your software projects continuously
making it easier for developers to integrate changes to the project, and making it easier for users
to obtain a fresh build. It also allows you to continuously deliver your software by integrating
with a large number of testing and deployment technologies.

With Jenkins, organizations can accelerate the software development process through
automation. Jenkins integrates development life-cycle processes of all kinds, including build,
document, test, package, stage, deploy, static analysis, and much more.

Jenkins achieves Continuous Integration with the help of plugins. Plugins allow the integration of
Various DevOps stages. If you want to integrate a particular tool, you need to install the plugins for
that tool. For example Git, Maven 2 project, Amazon EC2, HTML publisher etc.

The image below depicts that Jenkins is integrating various DevOps stages:

Advantages of Jenkins include:

1. It is an open-source tool with great community support.


2. It is easy to install.
3. It has 1000+ plugins to ease your work. If a plugin does not exist, you can code it and share it with
the community.
2
4. It is free of cost.
5. It is built with Java and hence, it is portable to all the major platforms.

There are certain things about Jenkins that separates it from other the Continuous Integration tool. Let us
take a look on those points.

Features of Jenkins:

The following are some facts about Jenkins that makes it better than other Continuous Integration tools:

• Adoption: Jenkins is widespread, with more than 147,000 active installations and over 1
million users around the world.
• Plugins: Jenkins is interconnected with well over 1,000 plugins that allow it to integrate with
most of the development, testing and deployment tools.

It is evident from the above points that Jenkins has a very high demand globally. Before we dive into Jenkins
it is important to know what is Continuous Integration and why it was introduced.

Installation of Jenkins

Step1:Click the link to download the jenkins latest package for


windows https://www.jenkins.io/download/ Java -version

Step 2: Download the Generic Java Package (war) file after download

Step 3: Check whether Java is downloaded or not. To check wether java is installed or not enter
following command

2
Java -version

Step 4:Open command prompt and run as Administrator and Enter the following net
start jenkins

Now,the jenkins is started. g command

2
Step 5: To access the Jenkins open the browser and type
localhost:8080

Click on the URL given below


http://localhost:8080/

Step 6: Now,it ask you the administrator password and the location is given goto the location
and copy the password and paste it here

30
Step 7:Now, you can see Customize Jenkins.In order to work with jenkins you need to install the
plugins can install suggest plugins or select plugins to install.

Step 8: Now plugins are getting installed.

Step 9: Now, It ask you to enter username ,password confirm password fullna me and email
address. Click on save and continue
Step 10: Now, Instance Configuration is asked Jenkins is running on localport a nd click on save
and finish

3
Step 11: Now, Jenkins is ready click on start using Jenkins.

Step 12: Dashboard appears as follows:

a) AIM:

To create a new job using Notepad in Jenkins

Procedure:

Step 1: Open localhost:8080 in browser.

Step 2: Open Dashboard and select New item.


3
Step 3: Enter an item name and select Free style project and click on ok.

Step 4:In Source Code Management select none.In Build select Execute Windows batch
command.Enter the commands as path of the project and commands to execute the project
and then click on save and apply.

Step 5: Now, the projecte is created and click on Build Now

3
Step 6: click on the Console Output to check the whether the output iscorrect or any error is
occurred

Step 7: Now,the dashboard looks like

3
b) AIM:

To create a new job using Git in Jenkins Procedure:

Step 1: Open localhost:8080 in browser.

Step 2: Open Dashboard and select New item.

Step 3: Enter an item name and select Free style project and click on ok.

Step 4: In General select GitHub project in it copy the URL of the GitHub account and paste it
in Project URL

Step 5: In Source Code Management select GIT in it copy the URL of the repository and paste
it in Repository URL.

3
Step 6: Select Branches to Build in default as master or you can select as your wish.

Step 7: In Build Triggers select Poll SCM in schedule type the numbers with space or you can
type the * instead and then click pn apply and save.

3
Step 8: Click on Build now and then click on Console output

Pipeline in Jenkins

Step 1: Open localhost:8080 in browser.

Step 2: Open Dashboard and select New item.

Step 3: Enter an item name and select Free style project and click on ok.

Step 4: In General select GitHub project in it copy the URL of the GitHub account and paste it
in Project URL
40

Step 5: In Source Code Management select GIT in it copy the URL of the repository and paste
it in Repository URL.

Step 6: Select Branches to Build in default as master or you can select as your wish.

Step 7: Click on apply and save

Step 8: Click on Build now and then click on Console output

40
Step 9: Enter an item name and select Free style project and click on ok.

Step 10: In General select GitHub project in it copy the URL of the GitHub account and paste it
in Project URL

Step 11: In Source Code Management select GIT in it copy the URL of the repository and paste it
in Repository URL.

41
Step 12: Select Branches to Build in default as master or you can select as your wish.

Step 13: Select Build after other projects are built. Enter item name of build and select trigger
only if build is stable

Step 14: click on apply and save

Step 15: check status

42
Step 16: click on Build now and Console output

Step 17: Enter an item name and select releaseproject and click on ok.

43
Step
18: In General select GitHub project in it copy the URL of the GitHub account and paste it
in Project URL

Step 19: In Source Code Management select GIT in it copy the URL of the repository and paste
it in Repository URL.

Step 20: Select Branches to Build in default as master or you can select as your wish.

44
Step

21: Select Build after other projects are built. Enter item name of deploy and select trigger
only if build is stable

Step 22: click on apply and save

Step 23: check status

Step 24:click on Build now and Console output

45
Step

25: Enter an item name and select maven project and click on ok.

Step 26: In General select GitHub project in it copy the URL of the GitHub account and paste it
in Project URL

Step 27: In Source Code Management select GIT in it copy the URL of the repository and paste
it in Repository UR

46
Step

Step 28: Select Branches to Build in default as master or you can select as your wish.

47
Step 29: Select Build after other projects are built. Enter item name of testand select trigger only
if build is stable

Step 30: check status

Step 31:click on Build now and Console output

Step 32:After creating all four jobs in

48
Step 33: Go to new view enter view name and select build pipeline and click on ok.

Step 34: In upstream/downstream config enter buildexample in Select Initial Job

Step 34: In upstream/downstream config enter buildexample in Select Initial Job

Step 35: In Trigger Options enter Standard build cards in Build Cards Enter
the options as No

Step 36: In Display Options, No Of displays build are 1 and remaining as shown and click on

Apply and Ok
Step 37:Now, dashboard appear as :

Step 38: Click on pipeline_example and run the Build pipeline.

Now, It look like

50
4

Introduction to Maven

Maven is a project management and comprehension tool that provides developers a

complete build lifecycle framework. Development team can automate the project's build
infrastructure in almost no time as Maven uses a standard directory layout and a default build
lifecycle.
In case of multiple development teams environment, Maven can set-up the way to work as per
standards in a very short time. As most of the project setups are simple and reusable, Maven
makes life of developer easy while creating reports, checks, build and testing automation setups.
Maven provides developers ways to manage the following −

• Builds
• Documentation
• Reporting
• Dependencies
• SCMs
• Releases
• Distribution
• Mailing list
Features of Maven:
• Simple project setup that follows best practices.
• Consistent usage across all projects.
• Dependency management including automatic updating.
• A large and growing repository of libraries.

• Extensible, with the ability to easily write plugins in Java or scripting languages.

• Instant access to new features with little or no extra configuration.


• Model-based builds − Maven is able to build any number of projects into
predefined output types such as jar, war, metadata.
• Coherent site of project information − Using
• the same metadata as per the build process, maven is able to generate a website
and a PDF including complete documentation.
Objective:
The primary goal of Maven is to provide developer with the following −
• A comprehensive model for projects, which is reusable, maintainable, and easier
to comprehend.
• Plugins or tools that interact with this declarative model. Test NG
o TestNG is a very important framework when you are actually developing the framework
from scratch level.
o TestNG provides you full control over the test cases and the execution of the test cases.
Due to this reason, TestNG is also known as a testing framework.
o Cedric Beust is the developer of a TestNG framework.
o If you want to run a test case A before that as a pre-request you need to run multiple
test cases before you begin a test case A. You can set and map with the help of
TestNG so that pre-request test cases run first and then only it will trigger a test case A.
In such way, you can control the test cases.
o TestNG framework came after Junit, and TestNG framework adds more powerful
functionality and easier to use.
o It is an open source automated TestNG framework. In TestNG, NG stands for "Next
Generation".
o TestNG framework eliminates the limitations of the older framework by providing more
powerful and flexible test cases with help of easy annotations, grouping, sequencing and
parametrizing.

Advantages of TestNG over Junit

o In TestNG, annotations are easier to understand than Junit. o It produces the HTML
reports for implementation. o It also generates the Logs.

52
o In TestNG, there is no constraint available such as @beforeclass and @afterclass which
is present in Junit.
o TestNG enables you to group the test cases easily which is not possible in JUnit.
o TestNG supports three additional levels such as @Before/After suite, @Before/AfterTest,
and Before/AfterGroup. o TestNG does not extend any class. TestNG framework allows
you to define the test cases where each test case is independent of other test cases.
o It allows you to run the test cases of a particular group. Let's consider a scenario where
we have created two groups such as 'Smoke' and 'Regression'. If you want to execute the
test cases in a 'Regression' group, then this can only be possible in the TestNG framework.
o Parallel execution of test cases, i.e., running multiple test cases is only possible in the
TestNG framework.

Procedure:

Step 1: goto maven repository

Step 2: search for test NG

53
Step 3:goto central and maven and copy the dependencies

AIM:

To create maven project and automatic testing using Test NG.

Procedure:

Step 1: Open eclipse IDE

54
Step 2: Open Dashboard and select New item.

Step 3: Enter an item name and select Maven project and click on ok.

Step 4: Give location to run the maven project.

Step 5: Enter the group id and artifact id and finish. These are identifiers of our project

55
Step 6: Now, to use Test NG we should go to maven repository search for testing.

Step 7: open pom.xml

Step 8: Select the latest version and copy the dependency code. Paste the

dependencies

56
Step 9: click on new and the other

Step 10:click on class and then click on next

Step 11: enter name and modifiers and method stubs you want to create and then click on finish

57
Step 12: create a sample program.

58
Step

13: right click and click on run as and then click on maven test.

Step 14: the output is seen in console as build success.

59
Step

Week -4

AIM:
To install docker and perform some basic commands.

Introduction
Docker
Docker takes away repetitive, mundane configuration tasks and is used throughout the
development lifecycle for fast, easy and portable application development – desktop and cloud.
Docker’s comprehensive end to end platform includes UIs, CLIs, APIs and security that are
engineered to work together across the entire application delivery lifecycle.

Build
• Get a head start on your coding by leveraging Docker images to efficiently develop your
own unique applications on Windows and Mac. Create your multi-container application
using Docker Compose.
• Integrate with your favourite tools throughout your development pipeline – Docker
works with all development tools you use including VS Code, CircleCI and GitHub.
• Package applications as portable container images to run in any environment
consistently from on-premises Kubernetes to AWS ECS, Azure ACI, Google GKE and
more.

Share
• Leverage Docker Trusted Content, including Docker Official Images and images from
Docker Verified Publishers from the Docker Hub repository.
• Innovate by collaborating with team members and other developers and by easily
publishing images to Docker Hub.
• Personalize developer access to images with roles based access control and get insights
into activity history with Docker Hub Audit Logs.

Run
• Deliver multiple applications hassle free and have them run the same way on all your
environments including design, testing, staging and production – desktop or cloud-
native.
• Deploy your applications in separate containers independently and in different
languages. Reduce the risk of conflict between languages, libraries or frameworks.
• Speed development with the simplicity of Docker Compose CLI and with one command,
launch your applications locally and on the cloud with AWS ECS and Azure ACI.

Procedure:
Step 1:To install and work with docker virtualisation should be turned on. It will be avaliable in
Bion virtualization.

60
2: Install.exe file from
docs.docker.com/windows/install

Step 3: Open.exe file as administrator. The package starts downloading

Step 4: In configuration check ✓ install the required windows. And click on ok

61
Step

Step 5: the packages are installing

Step 6: installation success and restart the system

Step 7: click on I agree term and accept

62
8: to login click on sign up

Step 9: enter name email and give password accept the terms and click on sign up

Step 10: the docker desktop look like


63
Step

Docker Commands

Docker version:

Docker pull:

this command is used to pull a image from docker hub.

Tags are used to identify images inside a repository . if we don’t specify a tag docker engine uses
the latest tag by default

Docker images:

We may have many images running in our machine to list all the running docker images is used.

The output list is running images with attributes repository,tags,image,id,created days since
(related),size

64
65
Week – 5

a) AIM:

To dockerize java application

Procedure:

step 1: open eclipse IDE

step 2: create new java project

step 3: enter the project name and click on next

65
Step 4: right click and click on new and then on class

Step 5: enter name and method stubs

66
Step 6: write a sample program

Step 7: right click on the program click on run as and then as java application

67
Step 8: open the console to see the output

Step 9: now, launch the terminal and check the docker version

68
docker --v

ersion

69
Step 10: right click on the project and then new and click on file

Step 11: enter the file name as Dockerfile

70
step 12: click yes

Step 13: enter the command


docker images

7
docker run helloworld:v1

Step 14: image appears as

b) AIM:
To dockerize python application Procedure:

Step 1: Create a folder on desktop.

Step 2: Open the created folder in VS Code.

Step 3: In that folder create a Dockerfile and type the code as shown below:

7
Step 4: In the same folder create a python file and type the code as shown below:

Step 5: And also create txt file in same folder and type the code as shown below:

The txt file name should match the name present in the docker code.
Step 6: To run these file open terminal in VS Code and enter the command:
Docker build -t pythonapp .

docker run -p 4000:80 pythonapp

7
Step 7: If open the docker the we can see:

c) AIM:
To dockerize html application

Procedure:

Step 1 : Step 1: Create a folder on desktop.

Step 2: Open the created folder in VS Code.

Step 3: In that folder create a Dockerfile and type the code as shown below:

Step 4: In the same folder create a html file and type the code as shown below:

7
Step 5: To run these file open terminal in VS Code and enter the command:
Docker build -t myhtml1 docker
images

Docker container run -d -p 5000:80 –name mywebsite myhtml1

Step 7: If open the docker the we can see:

7
7
Week-6

Ansible Experiment

What is Visual Studio Code (VS Code)?

VS Code is a source code editor that runs on your desktop and is available for Windows, macOS, and Linux.

Why use the Ansible VS Code extension?

Utilizing the Ansible VS Code extension capitalizes on VS Code's widespread adoption and sophisticated
ecosystem, offering an integrated environment where developers can efficiently write, run, and debug
Ansible content. The extension harnesses VS Code's editing, navigation, and debugging tools tailored for
Ansible to ease content development, making it a logical choice for automation.

How to install the Ansible VS Code extension

In the VS Code extensions marketplace, search and install ansible redhat.

When the extension is installed for the first time, the runtime status is "Not yet activated" which indicates that
the extension is not yet running. The status will be activated only after a file is opened in the editor and the
language identified for the file is Ansible.

For Windows users, the extension works with WSL2 and not on native Windows.

Ansible VS Code extension settings

The Ansible extension supports multiple configuration options. This allows the user to, for instance, change the
executable path for Ansible, ansible-lint, the Python interpreter, and so on. There is also an option to enable
the automation execution environment. Users can choose the container engine, image name, pull policy, and
more.

7
To see and change the configuration options in the VS Code window, go to Code -> Settings/Preference ->
Settings and in the Search settings box (Figure 2), type ansible.

Workspace settings versus user settings

You can set preferences for a given user or workspace, and depending on the environment, also for remote
type and workspace folder. User-based settings are applied globally for any instance of VS Code that is
opened. Workspace settings are stored within your workspace and only apply when the current workspace is
opened. Alternatively, for workspace settings, you can also provide the Ansible settings by editing

the .vscode/settings.json file within the workspace root folder (Figure 3).

7
The choice between workspace settings and userspace (user settings) in VS Code depends on the context and
needs of your projects. Here's why you might consider workspace settings to be better in certain scenarios:

• Project-specific configuration: Workspace settings are stored with your Ansible project, allowing you
to define and maintain configurations that are specific to that project. This means that any special
settings or extensions needed for the project won't interfere with your general VS Code environment or
other Ansible projects.
• Team collaboration: When working on a shared project, workspace settings help ensure consistency
across different team members' environments. By committing workspace settings to your version
control system, you can make sure every team member has the same configuration, reducing "works on
my machine" problems.
• Avoiding configuration conflicts: By using workspace settings, you can avoid conflicts between
Ansible project-specific configurations and your personal preferences in the user settings.
• Flexibility and control: Workspace settings provide flexibility, allowing you to switch between
different projects with their unique configurations seamlessly. You can have different settings for a
Python project, an Ansible project, and a C++ project, each optimized for the respective stack without
the need to manually reconfigure settings each time you switch projects.

Activating and using the Ansible VS Code extension

Now that you've installed the Ansible extension in VS Code, the next step is to either open an Ansible project
or create a new Ansible playbook project.

1. To open an Ansible project, follow the steps shown in Figure 4.


2. Open the directory that contains your Ansible playbooks by clicking Open Folder.
3. Ensure that the Ansible playbooks within your project are recognized as playbooks for the Ansible
extension to work. Ansible playbooks are YAML files, so the YAML extension within VS Code
recognizes them as such. There are a few ways to ensure that the playbooks are assigned the Ansible
language, including:
o YAML files under ./playbooks dir.
o Files with the following double extension: .ansible.yml or .ansible.yaml o
Notable YAML names recognized by Ansible like site.yml or site.yaml o YAML files
having playbook in their filename: *playbook*.yml or *playbook*.yaml

7
4. Additionally, in VS Code, you can add persistent file association for language to settings.json files like
this:
5. { 6.
...
7.
8. "files.associations": {
9. "*plays.yml": "ansible",
10. "*init.yml": "yaml",
11. }
12. }

Copy snippet
13. You can also manually associate the Ansible language to the file if the file is recognized as a YAML file.
Follow the instructions associated with Figure 5.
14. Hover the cursor on the language identified (YAML in this case) in the bottom right corner. You will see
Select Language Mode

15. Type Ansible in the tab and then select it. After doing this, the identified language for the file is changed
to Ansible (Figure 6).

16. When a file is recognized as Ansible, the Ansible VS Code extension provides specific features for
creating Ansible playbooks and task files, such as auto-completion, hover, diagnostics, goto, and more.
The extension also relies on the Red Hat vscode-yaml extension to provide auto-completion and
diagnostics information of other related files like Ansible vars files, ansible-navigator settings files,
ansible-galaxy requirements and metafiles, ansible-lint configuration files, and other YAML files.

7
Week - 7

Set up your Ansible development environment

A set of tools is provided with Ansible Automation Platform to help automation creators to create, test, and
deploy collections containing playbooks, roles, modules, and plugins.

Install the Ansible development environment

These packages are available via the Ansible Automation Platform setup bundle as RPM packages. The Red Hat
recommended way is to set up these tools as part of your Python virtual environment inside the Ansible project

workspace. First, install these RPM packages using the steps below. 1. Open the terminal in VS Code. Go to

Terminal -> New Terminal in the toolbar and enter:

2. $ dnf config-manager --enable ansible-automation-


platform-2.4-for-rhel-8-x86_64-rpms
3.

$ dnf install ansible-core ansible-navigator ansible-lint ansible-builder


Copy snippet
4. Follow the steps below to set up the packages in your workspace:
5. # setup a venv called project-venv with system site-packages
6.
7. $ python3 -m venv --system-site-packages project-venv
8.
$ source project-venv/bin/activate

Copy snippet
7
Info alert: Make sure the Python interpreter used to initialize the virtual environment is the same as
the system default. You can run the pip freeze | grep ansible command to check if all required
developer tools are part of your virtual environment.

9. Point the Python interpreter in VS Code to the one in the virtual environment. This ensures that all the
required developer tooling comes from the correct location.
10. Now you can start working on your Ansible project using the Ansible VS Code extension

Use automation execution environments

Prerequisite: Install a container engine such as Podman or Docker on your workstation.

To list the automation execution environments supported by the extension, open the VSCode settings (Code ->
Settings/Preferences -> Settings) and type ansible.execution environment (Figure 8).

7
Info alert:Alternatively, you can click the Ansible extension in the extension marketplace and then click the
gear icon to open the extension settings. See Figure 9.

After enabling the execution environment (EE), the extension will pull the ghcr.io/ansible/creator- ee:latest
image by default, if it is not present locally. The value of the image can be changed by providing the intended
value for ansible.executionEnvironment.image setting. After the EE pull is successful, the Ansible extension will
copy the plug-ins docs from within EE to the local cache folder and it will be used to provide autocompletion,
hover and goto functionality. Since the creator-ee image has ansible-lint bundled, the Ansible extension and
ansible-language-server will volume mount the entire workspace within the EE and run ansible-lint or ansible-
playbook-syntax- check based on settings to provide diagnostics information in editor.

7
VIVA QUESTIONS
1. What is DevOps?

2. Who is a DevOps engineer?

3. What is the use of SSH?

4. What is configuration management? 5. What is Continuous Integration (CI)?

6. Explain the different phases in DevOps methodology.

7. How is DevOps different than the Agile Methodology?

8. Differentiate between Continuous Deployment and Continuous Delivery?

9. What are the various branching strategies used in the version control system?
10. Can you say something about the DevOps pipeline?

You might also like