DEVOPS
DEVOPS
Note: There are online courses indicated in the reference links section. Learners need to go
through the contents in order to perform the given exercises
Exercise 1:
Reference course name :Software engineering and Agile software development
Get an understanding of the stages in software development lifecycle, the process models, values and
principles of agility and the need for agile software development. This will enable you to work in projects
following an agile approach to software development.
Solve the questions given in the reference course name to gauge your understanding of the topic
Exercise 2:
Reference course name: Development & Testing with Agile: Extreme Programming
Get a working knowledge of using extreme automation through XP programming practices of test first
development, refactoring and automating test case writing.
Solve the questions in the “Take test” module given in the reference course name to gauge your
understanding of the topic
Exercise 3:
Module name : DevOps adoption in projects
It is important to comprehend the need to automate the software development lifecycle stages through
DevOps. Gain an understanding of the capabilities required to implement DevOps, continuous integration
and continuous delivery practices.
Solve the questions given in Quiz1, Quiz2, Quiz 3
Exercise 4:
Module name :Implementation of CICD with Java and open source stack
Configure the web application and Version control using Git using Git commands and version control
operations.
Exercise 5:
Module Name: Implementation of CICD with Java and open source stack
Configure a static code analyzer which will perform static analysis of the web application code and identify
the coding practices that are not appropriate. Configure the profiles and dashboard of the static code analysis
tool.
1
lOMoAR cPSD| 42578591
Exercise 6:
Module Name: Implementation of CICD with Java and open source stack
Write a build script to build the application using a build automation tool like Maven. Create
a folder structure that will run the build script and invoke the various software development
build stages. This script should invoke the static analysis tool and unit test cases and deploy
the application to a web application server like Tomcat.
Exercise 7:
Module Name: Implementation of CICD with Java and open source stack
Configure the Jenkins tool with the required paths, path variables, users and pipeline views.
Exercise 8:
Module name: Implementation of CICD with Java and open source stack
Configure the Jenkins pipeline to call the build script jobs and configure to run it whenever
there is a change made to an application in the version control system. Make a change to the
background color of the landing page of the web application and check if the configured
pipeline runs.
Exercise 9:
Module name: Implementation of CICD with Java and open source stack
Create a pipeline view of the Jenkins pipeline used in Exercise 8. Configure it with user
defined messages.
Exercise 10 :
Module name: Implementation of CICD with Java and open source stack
In the configured Jenkins pipeline created in Exercise 8 and 9, implement quality gates for
static analysis of code.
Exercise 11:
Module name :Implementation of CICD with Java and open source stack
In the configured Jenkins pipeline created in Exercise 8 and 9, implement quality gates
for static unit testing.
Exercise 12:
Module name :Course end assessment
In the configured Jenkins pipeline created in Exercise 8 and 9, implement quality gates for code coverag e.
lOMoAR cPSD| 42578591
Exercise 1
Aim: Understanding of the stages in software development lifecycle, the process
models, values and principles of agility and the need for agile software
development.
Procedure:
Software Engineering:
SoftwareEngineering
4. Difficulty in maintenance
Life cycle: -
Models: -
1.Waterfall
2.Prototyping
3.Spiral
Project Roles: -
1. Project Sponsor
2. Business Team
3. Developers
4. Tester
5. Support Team
6. Designer
7. Architect
8. Project Manager
Why Agile:
Benefits:
2. Quality software
Principles:
1. Our highest priority is to satisfy the customer through early and continuous delivery
of valuable software.
4. Businesspeople and developers must work together daily throughout the project.
5. The most efficient and effective method of conveying information to and within a
development team is face-to-face conversation.
6. Build project around motivated individuals give the environment and support they
need and trust them to get the job done.
9. Continuous attention to the technical excellence and good design enhances agility.
10.The best architecture, requirements and design emerge from self- organizing teams.
11. At regular intervals, the team reflects on how to become more effective, then tunes
and adjusts its behavior accordingly’
12. Simplicty—the art of maximizing the amount of the work not done-is essential.
lOMoAR cPSD| 42578591
Exercise 2
Procedure:
Extreme Programming:
Will use Git which is a source control tool to be using in Extreme Programming. It
provides 12 practices such as code refactoring continuous Integration etc.
1. Quality Improvements
2. Process Improvement
3. Customer Satisfaction Improvements
Advantages:
Roles:
7. Feedback
Practices:
8. Courage: Discuss about a project to the company head
9. Respect
● Whole team
● Sir together
● Informative workspace
● Energized work
● Pair Programming
● Stories
● Weekly and quarterly cycles
● Slack
● Ten-minute build
Planning:
● Plan
● Design
● Code
● Test
Feedback:
● Organized meeting
● Ensures quality improves design
● Promotes effective project management
● Two parts-release planning and iteration planning
lOMoAR cPSD| 42578591
Release Planning:
● Customer
● Software developer
● What software
● How it works
1. Functionality
2. Release date
● PLANNING GAME
1. Release Planning
2. Iteration Planning
1. Release Planning
1. Exploration
2. Commitment
3. Steering
2.Iteration
Planning
1. Exploration
2. Commitment
3. Steering
● Adding
● Reviewing
● Revising
● Assign tasks
lOMoAR cPSD| 42578591
● Determine duration
lOMoAR cPSD| 42578591
● Complete tasks
● Validate design
● Evaluate design
● Adjust
Pair Programming
● Two programmers
● Shared workstation
● Regular role switching
Benefits
Skills level:
● Beginner
● Intermediate
● Advanced
Disadvantages:
● Pair Programming
1. Instant and regular code review
2. Require both programmers
3. Shared Understanding
4. Real-time correction
5. Reduces risks
● Code Reviews
1. Separate programmer looks at code at a later time
2. Testing, quality, control
lOMoAR cPSD| 42578591
Back-Seat Navigation:
● Tactical focus
● Both tactical and strategic
● Design
● Coding
● Testing
Levels:
● Traditional Testing
● Focuses on test case design
Considerations:
Benefits:
● Maintains single source
● Facilities collaboration
● Accelerates velocity
SCM Tools:
4. In GitHub main branch will be the root branch. To this branch, anyno.of sub
branches can be created.
5. Let's create a new application code and save it in repository
(iii) Open GitHub desktop and click on clone repository from the internet
(iv) It asks which repository is to be cloned and select the repository and then
click on "Clone".
Continuous Integration:
Benefits:
● Rapid time to market
● Faster development life cycles
● Increased quality
● Better risk mitigation
Risks :
● Costs for maintaining and managing
● Requires established guidance before use
● Lack of experience
● Requires full test coverage
● May mid guide team focus
Benefits:
● Requires commit code
● Categorize developer tests
● Use a dedicated machine
● Integrate continuous feedback
● Stage your build
Coding Standards
● Consistency
● Manageability
● Mandatory
● Guidelines
● Recommendations
● Format
● Code structure
● Naming conventions
● Error Handling
● Comments
Knowledge Sharing:
Code Excellence:
● Increased quality
● Style efficiency
● Continuous learning
● Shorter learning time
● No Individual Ownership
● Relies on team expertise
● May hinder motivation
● Not suited for Specialized functions
Code Refactoring:
Refactoring Benefits:
● Maintainability
● Extensibility
Refactoring Techniques:
● Red/green
● Refactoring by abstraction
● Composing method
● Simplifying method
● Preparatory
● Moving features between objects
Refactoring process:
● Identify
● Conduct
● Test
● Repeat
The problems
Restructuring:
● Reduce duplication
● Resize classes and methods
Addressing Duplication:
● Extract
● Replace
Simplifying
Small Releases:
Prepare
● Evaluate
● Identify team goals and strategies
Iteration Details
● Value to customer
● Maximum two weeks between iterations
● Quality
● Incorporate feedback
● Experiment
● Add new features
System Metaphor
● Common vision
● Generativity
● Shared vocabulary
● Architecture
Advantages
Disadvantages:
Best Practices:
● Single view
● One structure type
● Clear design guidance
● System properties focus
● Shared experience
Key Concepts
Benefits
● Problem exposure
Considerations
● Development
● Quality
● Delivery
● Improvement
● Experiment
● Increase slowly
● Track
Course Summary
● Extreme Programming
● Planning Game Practices
● Pair Programming
● Test - Driven Development
● Customer Role practice
● Source Control Management and Coding standard
● Continuous Code Ownership and Code Refactoring
● Small Releases and System Metaphor
● The 40 - hour work week
lOMoAR cPSD| 42578591
Exercise 3:
Aim: Comprehend the need to automate the software development lifecycle stages
through DevOps. Gain an understanding of the capabilities required to implement
DevOps, continuous integration and continuous delivery practices.
Procedure:
Dev-ops Adoption in Projects:
It is the important to comprehend the need to automate the software development
lifecycle stages through Devops, gain an understanding of the capabilities required to
implement Devops, CI, and CD
Devops:
It is the combination of development team and operational team.
• Version source code
• Code quality analysis
• Unit testing
• Code coverage
• Create executable
• Baseline the executable
They are the different test done by development and delivery pipeline.
Continuous delivery and automation:
CD allows constant flow of changes into production through automated software
production pipeline called CD pipeline.
Infrastructure layer and environment management:
This provides required infrastructure for development.
This infrastructure can be managed by tool called as chef.
Chef: helps in spinning of virtual machine synchronized them and made changes
across multiple servers.
Operations team:
lOMoAR cPSD| 42578591
Operational team contains 2 types of dash boards to measure devops adoption and
health of pipeline.
1. Business performance dashboard
➢ Depict the revenue and speed of deployment defect status.
It is an open-source tool which is free of cost, eclipsed IDE also open-source tool
which contain e-git plug-in.
➢ Static code analysis: SonarQube
Very powerful, integrated with eclipse IDE used for coding and helps write
Compact scripts. It is compactable with the tools mentioned.
➢ Artifact repository: artifact repository supports Maven free and open source.
➢ Continuous Integration: Jenkins free, open source, powerful and
➢ integrates with all the tools mentioned.
lOMoAR cPSD| 42578591
Exercise 4
Aim: Configure the web application and Version control using Git using Git
commands and version control operations.
Tools Required: Git, Github cloud account, Internet connection, browser, Github
Desktop(optional).
Theory:
Github: GitHub is a website and cloud-based service that helps developers store and
manage their code, as well as track and control changes to their code.
Procedure:
Step-1: Open your browser and search for github and click on link: https://github.com/
Step-2: Now sign with your existing GitHub credentials or sign up for a new GitHub
account.
Step-3: After sign-in click on new to create a new repository. Add your name to your
repository and check on add a readme file and click on create repository. It creates a
new repository.
Step-4: And then install Git in your Pc by using the link: https://www.git-scm.com/
And then after installation complete open the Git-bash.
Type these commands:
Step-5: After login with your credentials and type these commands to commit the file.
Step-6: Now push the file to cloud repository. So we use the command.
lOMoAR cPSD| 42578591
Step-7: Now open the github cloud and click on compare and pull request and then all
files are stored in master branch.
Step-8: Now create a new branch and again step those files in that branch.
The commands are:
lOMoAR cPSD| 42578591
Now we pushed the files into the new branch named branch1.
Let check it at github cloub whether the branch is created and files are pushed or not.
lOMoAR cPSD| 42578591
Step-9: Now we clone the files into a one new directory(i.e in Local repository) from
github cloud repository
The commands are:
lOMoAR cPSD| 42578591
After cloning the files check the files whether they are opening or not.
Conclusion:
We learned how to use the github cloud and their git commands to push the files to
cloud repository, creating a new branch, and cloning the files from github cloud to
local repository.
lOMoAR cPSD| 42578591
Exercise 5
Aim: Configure a static code analyzer which will perform static analysis of the web
application code.
Tools Required: SonarQube 7.9.6 LTS, Java 11, Sonar Scanner 4.7, Eclipse IDE,
Internet Connection.
Theory:
Static Code Analysis: Analysing the code without executing is called static code
analysis.
• For performing static code analysis we are using SonarQube which is a web
page open source tool to manage code quality.
SonarQube: SonarQube checks the code whether the comments, coding rules are
followed correctly and properly or not.
• Checks for code complexity.
• Checks for duplication in code.
• It covers only the C, C++, Java Languages only.
• It has a list of built-in rules for different programming languages and these
rules are called Profiles.
Procedure:
Step-1: Go to any search engine and type Download SonarQube 7.9.6 or go to this
link: https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-7.9.6.zip
lOMoAR cPSD| 42578591
Step-2: After completion of downloading extract into a specified folder. And open the
extracted SonarQube 7.9.6 folder and click on bin and copy the path of folder upto
BIN.
in my case: E:\sonarqube-7.9.6\bin)
Step-3: Go to Settings (for Windows 10 or Windows 11) and click on System and go
to about -click on Advanced System Settings and click on Environment variables and
on system variables go and edit the path and add new path by clicking New and paste
the path of SonarQube extracted folder.
Step-5: After installing open the Eclipse IDE and click on File and click New to create
the Java Project.
Give the project name and details of project and click on finish.
Step-6: After creating the java project and then right click on your project folder and
click on new to create a Class file.
lOMoAR cPSD| 42578591
In Src folder contains the main class file and write your code on that file and save it.
lOMoAR cPSD| 42578591
Step-7: Right click on SonarProj1 (or your project name) and click on properties and
copy the path of your project workspace.
And then again open the browser and search for SonarScanner 4.7 and download it.
And extract the folder at one place (or you can extract the file where you have extract
SonarQube file). And copy the path of your SonarScanner folder upto Bin folder.
lOMoAR cPSD| 42578591
Step-8: And again open the Sonar-Scanner folder after that click on conf folder and
then edit the “ sonar-scanner ” file in either notepad or VS code.
Add these contents to that file without deleting any contents in that file.
Step-9: To run the Sonar-Scanner open the command prompt and change the directory
of SonarQube upto bin/windows-x86-64/
Step-10: From here onwards we must run the SonarQube-7.9.6 on Jdk 11 (or) Java
SE 11. So uninstall and delete the path in environment variables of higher version or
lower versions of java.
Java SE 11: https://www.oracle.com/in/java/technologies/javase/jdk11-archive-
downloads.html#license-lightbox
lOMoAR cPSD| 42578591
And after installation of Java SE 11 then set up path of java in Environment variables.
And then type in command prompt where the path is at SonarQube up-to windows-
x86-64 then type this command:
>StartSonar.bat
Step-11: After getting the script like Process[ce] is up and SonarQube is up and
then open your browser and type this URL: http://localhost:9000
• Where this URL was found in SonarScanner folder->conf folder->sonar-
scanner file.
lOMoAR cPSD| 42578591
• In that file it contains “sonar.host.url” where the URL was default to that file
where we can change when we want in that file.
Step-12: And now open the another command prompt window and then change the
directory to your project workspace which is located at eclipse workspace directory.
My project workspace can be seen at eclipse also i.e :
Step-13: Now open your browser which is previously that we opened that
SonarQube server, refresh it and then see the projects and click on the project to see
the status of project.
Step-14: As that I was highlighted in a box click on 1 of projects analyzed to see the
status. And click on your project name to see the full status as given below.
lOMoAR cPSD| 42578591
Step-15: If there is any errors are occurred in project then it displays as like:
I have created another project named sonarProj2 and I created a class with named
smileyProj2 with some errors.
And I am following above same process upto opening of SonarQube. Now I am
configuring the sonar-scanner.properties file with the details of project:
And I executed with sonar-scanner at sonarProj2 project directory and then now
check at SonarQube whether it raises any errors or not:
lOMoAR cPSD| 42578591
And now open the SonarQube server webpage to see the project is added or not:
Yes the another was successfully added. Click on 2 to open the projects.
lOMoAR cPSD| 42578591
In the below photo it shows us issues and errors in the following code.
lOMoAR cPSD| 42578591
Conclusion:
We concluded that we had learn on how to do the static code analysis with SonarQube
and with sonar scanner.
lOMoAR cPSD| 42578591
Exercise 6:
Aim: Write a build script to build the application using a build automation tool like
Maven. Create a folder structure that will run the build script and invoke the various
software development build stages.
Tools: Eclipse IDE, Apache Maven(version: 3.8.6)
Theory:
Maven: A maven is a build tool that helps in project management. This tool helps in
building and documenting the project.
• Maven is a build automation tool written in Java and C# and this is based on
Project Object Model (POM).
• POM is fundamental unit in maven. It is an XML file which resides in the
base directory of our project.
• When we execute a maven project it searches for the POM in the current
working directory.
• POM contains:
1.Project Dependencies
2.Plugins
3.Build profiles
Maven build Lifecycles:
1. Clean: It cleans the target directory for to deploy the project.
2. Validate: It will checks whether the project is correct and by checking all the
necessary information.
3. Compile: Compile the source code of project.
4. Test: Test the compiled source code using a suitable unit testing framework.
5. Package: Take the compiled code and package it in its distributable format, such as
a JAR.
6. Install: Install the package into the local repository, for use as a dependency in other
projects locally.
7. Deploy: Done in the build environment, copies the final package to the
remote repository for sharing with other developers and projects.
Eclipse: Eclipse is an IDE(Integrated Development Environment) for developing
java projects.
lOMoAR cPSD| 42578591
Procedure:
Maven Installation:
o And click on ok and then go to variable Path -> and click on new under
path variable tab and and give the name as %M2_HOME%
o And paste another path of maven up to bin folder: E:\apache-maven-
3.8.6\bin
lOMoAR cPSD| 42578591
➢ And then open command prompt to check if it correctly installed its path in
environment variables.
➢ Type the command in command prompt as ‘mvn -version’
And then click 4th option in Run As i.e: Maven Build and give the goals as
validate to validate and click run
lOMoAR cPSD| 42578591
After that again click on 4th option in Run As i.e: Maven Build and give the
goals as compile to compile it and click run.
lOMoAR cPSD| 42578591
Before the maven install lifecycle the target folder is empty where as by
lifecycle of install the target contains files of built project with “projectname-
0.0.1-SNAPSHOT.jar”
lOMoAR cPSD| 42578591
Step-5: To run the class file which is located at target folder named with classes
directory.
Paste the path upto classes directory in command prompt and click the
command to run the class file as
>java com.Mynewbee1.MavenApplication.App
lOMoAR cPSD| 42578591
The .jar file under the target folder after maven install is :
Conclusion:
After performing all maven build lifecycles it creates class file and jar
files in target folder of certain project.
lOMoAR cPSD| 42578591
Exercise 7
Aim: Configure the Jenkins tool with the required paths, path variables, users and
pipeline views.
Tools required: JDK-11, Jenkins 2.361.3 LTS
Theory:
Jenkins: Jenkins is an open source automation server. It helps automate the parts of
software development related to building, testing, and deploying, facilitating
continuous integration and continuous delivery.
• It is a server-based system that runs in servlet containers such as Apache
Tomcat.
Procedure:
Step-1: First go to website of Jenkins download :
https://www.jenkins.io/download/
Step-2: Download the Jenkins 2.361.x LTS of Generic Java Package with the
extension of .war file. Save that file in a particular directory for easy accessing
(in my case the filed is stored in E:drive).
Step-3: Java version will be JDK 11 only. Install the JDK 11 and remove higher
versions or lower versions of Java.
Step-4: Set the path of JDK 11 in Environment variables.
lOMoAR cPSD| 42578591
Step-5: Open the command prompt and make sure the path will be your Jenkins
file saved path.
Change the path to Jenkins file path and then click this command:
>java -jar Jenkins.war
Then it will extract its file into windows system and then it executes its
operation.
Step-6: Open your default browser and then the Address as:
http://localhost:8080
It will redirects to this page for first time using of Jenkins.
Conclusion:
We learned how to install the Jenkins and its plugins.
lOMoAR cPSD| 42578591
Exercise 8
Aim: Create a Free style project in jenkins by integrating Maven Project and
executing the project in Jenkins IDE.
Tools Required: Jenkins LTS, Java with JDK 11, Apache maven.
Procedure:
Step-1: Open Jenkins tool in which we discussed in Exercise -7. And click on
New Item to create a new item with “freestyleproject” and give the name for
the project and then click Ok.
lOMoAR cPSD| 42578591
Step-2: After creating the item it redirects into another configuration menu. In
this configuration menu under General give your description and click apply.
Step-3:
Installation of Plugins or Dependencies:
For the installation of plug-ins, First go to homepage of Jenkins and go to
Dashboard and click Manage Jenkins and then click on Global Tool
Configuration under manage Jenkins.
lOMoAR cPSD| 42578591
Step-5: On Build Steps by clicking on advanced button and Enter the POM path
under POM in which the path will be project of java:
C:\Users\chara\eclipse-workspace\MavenApplication\pom.xml
And then click on apply and Save it.
Step-6: On your project there are some options are at left side and click on
Build Now option to run the maven project on Jenkins.
lOMoAR cPSD| 42578591
Conclusion:
We finally conclude that we have learned how to create a freestyle project.
lOMoAR cPSD| 42578591
Exercise 9
Aim: Develop a jenkins application that will integrate with the code in Github.
Tools Required: Jenkins, Github desktop or Git-bash, Integrated Browser(Edge or
Chrome).
Theory:
Jenkins: Jenkins is an open-source automation server. It helps automate the
parts of software development related to building, testing, and deploying,
facilitating continuous integration and continuous delivery.
Procedure:
Step-1: Create a Hello world program in Python or Java language and save it on one
path (at my case I had used the python language).
Step-2: Open the Git-bash to push the file into github repository. Create a repository
named Jenkins-Git-Integration.
And then change the directory to where the python file is saved. And initialize the
repository to that directory.
lOMoAR cPSD| 42578591
And then apply the commands of git which will be discussed at exercise-4 for up-to
pushing a file to global repository.
Step-3: Open the Jenkins by typing java -jar Jenkins.war and then go to Jenkins
homepage and click on new item and named it as “Jenkins git integration” as a
freestyle project and click on Ok.
Step-4: To execute github project under Jenkins then go to Dashboard and click on
Manage Jenkins and click on Manage plugin.
lOMoAR cPSD| 42578591
Step-5: At available search for “git plugin” and click on Install without restart.
Again search for “GitHub integration” and click on Install without restart.
For git plugin:
lOMoAR cPSD| 42578591
Step-7: Go to Build Triggers and check the Poll SCM and under Schedule input it
as * * * * *
It means that it has polls every minute.
lOMoAR cPSD| 42578591
Go to Build steps and select under Build steps as Execute windows Batch Command
Under Command, type your command to compile and execute the program. For each
programming languages there is a difference command to run the code.
For Java:
javac program_name.java
java program_name
For python:
python program_name.py
lOMoAR cPSD| 42578591
And check the output of project code by right clicking it displays some options and
click on console output to display its brief output.
lOMoAR cPSD| 42578591
Conclusion:
we finally conclude that we had learned how to integrate the Jenkins and github and
how to build and test our software projects continuously making it easier for us to
integrate changes to the project, and making it easier to obtain a fresh build.
lOMoAR cPSD| 42578591
Exercise 10
Aim:
A. Create Jenkins pipeline by creating Pipeline script as well as
Declarative Script.
B. Configure Jenkins pipeline setup by executing the declarative script that
is stored in Github cloud.
Tools Required: Jenkins, Java 11, Github cloud account.
Theory:
Jenkins: Jenkins is an open-source automation server. It helps automate the
parts of software development related to building, testing, and deploying,
facilitating continuous integration and continuous delivery.
Procedure:
Step1: First download the Jenkins file from the webpage:
https://www.jenkins.io/download/ of version 2.361.3 with LTS (Long term
support) of extension war file. This was discussed on exercise -7.
Step-2: Now open the command prompt and change the directory to Jenkins
folder and type the command as:
>java -jar Jenkins.war
And then click enter. It executes its operation as shown in below:
lOMoAR cPSD| 42578591
Step-3: And then now open the browser and type the address as:
http://localhost:8080/
Step-4: Click on new item and name your item (in my case I named it as Jen
Pipeline) and select as a pipeline project.
lOMoAR cPSD| 42578591
Step-6: Now click on Build Now and then click on the output number to see
console output.
lOMoAR cPSD| 42578591
Stage view:
Declarative Pipeline:
It has limited predefined structure.
Step-3: Under Branches to build at branch specifier type the branch name in which
the file is existed. At my case it is main branch.
And to check the console output click on output file and click console output.
Conclusion:
We conclude that we learn how to implement pipelines in Jenkins and how to
declare a Declarative pipeline with stages.