Devops Manual
Devops Manual
DEPARTMENT OF CSE
Prepared By
Dr.A.Radhika
Course Outcomes:
List of Programs
1)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
2) Get a working knowledge of using extreme automation through XP programming practices of test first
development, refactoring and automating test case writing
3) 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.
4) Configure the web application and Version control using Git using Git commands and version control operations
5) 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.
6) 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
7) Configure the Jenkins tool with the required paths, path variables, users and pipeline views.
8) 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
9) Develop a Jenkins application that will integrate with the code in Github
10) 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
EXERCISE: - 1
1)Understanding of the stages in software development lifecycle, the process models,
values and principles of agility and the need for agile software development .
Software Engineering: -
2. Clarity on requirements
4. Development
5. Testing
Software Crisis: -
4. Difficulty in maintenance
Definition: -
Life cycle: -
1.Waterfall
2.Prototyping
3.Spiral
Waterfall: -
Spiral Model: -
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
1. Our highest priority is to satisfy the customer through early andcontinuous delivery of valuable software.
2. Welcome changing requirements, even late in development. Agileprocess harness change for the
customer’s competitive advantage.
3. Delivery working software frequently, from a couple of weeks to acouple of months, with a preference to
the shorter time scale.
5. The most efficient and effective method of conveying information to andwithin a development team is
face-to-face conversation.
6. Build project around motivated individuals give the environment andsupport they need and trust them to
get the job done.
8. Agile processes promote sustainable development. Thesponsors, developers and users should be able to
maintain a constantpace indefinitely.
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’
Get a working knowledge of using extreme automation through XP Programming practices of test first
development, refactoring and automating test case writing.
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.
Methodology to integrate Agile into Software Development for an Efficient and Dynamic team.
1. Quality Improvements
2. Process Improvement
3. Customer Satisfaction Improvements
Advantages:
Roles:
7. Feedback
9. Respect
Practices:
● 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
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
● Determine duration
● 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
3. Limited understanding after act
Back-Seat Navigation:
● Tactical focus
● Both tactical and strategic
● Design
● Coding
● Testing
Considerations:
Benefits:
SCM Tools:
(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:
Risks :
Benefits:
Coding Standards
● Consistency
● Manageability
● Mandatory
● Guidelines
● Recommendations
● Format
● Code structure
● Naming conventions
● Error Handling
● Comments
Knowledge Sharing:
Code Excellence:
● Increased quality
● Style efficiency
Remove dependencies on Individuals:
● 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
Changing standard project architecture names to easily understood non -technical terms of phrases
● Common vision
● Generativity
● Shared vocabulary
● Architecture
Advantages
Disadvantages:
Best Practices:
● Single view
● One structure type
● Clear design guidance
● System properties focus
● Shared experience
● The practice of not requiring programmers or software developers to work more than 40
hours per week or work overtime two weeks in a row
Key Concepts
Benefits
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
Excercise-3
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.
Devops 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:
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.
Tools:
Continuous integration lifecycle stage:
Version control: Git
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.
EXERCISE: -4
Configure an application and Version control using Git using Git commands and
version control operations
Step 1: - Create an account in GitHub
Step 2: - Download GitHub desktop
Step 3: - Go to GitHub login. Create a Repository and name the repository as Initial Task
Step 4: - click on checkbox of add a readme file and then click on create Repository
Step 5: - Open your GitHub Desktop and click on file and click on clone repository and select repository to
clone and click on clone
Step 6: - click on Open in Visual Studio code and create a program that you want and click on save
Step 7: - Now got to Git Hub desktop and click on commit to main and you see a request push origin click
on it
Step 8: - Now go to GitHub cloud and you see the code in local to global
Convert Local Repository to Global Repository
Step 1: - open GitBash and you see a “$” like this and type dir. command it displays all your Directories
In your local Repository
Step 2: - create another new Repository in GitHub Cloud and name it as cse1 and go to GitBash and use
cd desktop to change the location
Step3: - In the GitBash type gitinit to initialize empty Repository
Step 4: - now create two files and create a java file and txt file and save them
Now go to git bash and type git add – this command will add your file to staging area
So type git add cse.java, git add local.txt
Step 5: - after this above two commands now commit the file and type git commit -m “this was changed by
admin”
Commit -m this is file changes
Step 6: - now connect your local repository t0 global repository by using
Git remote add origin “URL “this command clone the present working directory to the GitHub repository
from
Step 3: - Now to connect global to local now type git clone to clone from global to local
Step 4: - Now go to GitHub cloud and click on Add File and click on New File and in that file type some
text into it
Step 5: - after creating files in GitHub cloud and again go to GitBash and type ls command to know the
repository containing any files in GitHub cloud
And move the command to cd local1 and ls to list the files contains in local1 repository of GitHub
Exercise: -5
Configure a static code analyzer which will perform static analysis of the application
code.
Step 1: - Download Sonar Qube 5.4 and Download Sonar Scanner 4.7.0
Step 2: - Go to control panel go to system and advanced system settings and click on environment variables
and click on new paste the path that you copied from two downloads
Step3: - Go to google click Eclipse Ide for java Developers. Click on install and show work area
Step 4: - Creation of project using Eclipse IDE
Go to File and click on new- click on java project and type the name that you want and click on finish
Step 5: - Go to sonar Scanner and go to config and go to sonar properties and edit the file
Step 6: - In order to Run the Sonar Scanner, go to the files of sonar cube and copy up to windows bit version
And go to your command prompt and use cd and path of sonar qube and say start sonar.bat to start your
server present in it
Step 3: - and now go to the application and click on new class and name the class and click ok to create the
class
Step 4: - go to your maven project and right click and run as maven clean this command clean is target
Folder
Step 5: - go to your maven project and right click and run as maven build this command have goals and
name it as validates, and which checks your maven project
Step 6: - go to your maven project and right click and run as maven build this command have goals and
name it as compile to execute the java programs and create the corresponding class files under target folder
Step 7: - to run the run the class file go to place where maven is installed and copy the path and run on
command prompt as java com. srkit. myapplication. App
Step 8: - to test Maven Application run as Maven Test
Step 9: - go to your maven project and right click and run as maven install this command will create a jar
file which is stored under Target
EXERCISE: -7
Configure the Jenkins tool with the required paths, path variables, users and pipeline
views.
Execution of Maven project using Jenkins
Jenkins is a CI / CD tool prerequisites to install Jenkins
1.) JDK 11
2.) 2GB RAM
3.) Set Environmental Variable path- C:\Program Files\Java\jdk-11.0.17\bin
4.) Go to Browser click on download Jenkins (https://www.jenkins.io)
5.) Download LTS Version (long term support version) of Jenkins – downloads Jenkins 2.3.61.2 war file
Copy. War file to D drive
Go to command prompt and go to where the Jenkins file is downloaded and in it type the commands as
Java -jar Jenkins. War
After it’s done it will show you a password go to browser and type http://localhost:8080
It will show a Jenkins page for administrator password
Step 2 : - go to git bash where your java file is stored and same as your local to global files and following
commands – git init : to intialize empty repository – git add filename.java – to add your file to cmd
- Git commit -m “ message” : it will tell that there are no more changes
Git remote add origin https://github.com/20X41A0550/Integration - of - github.git : to remotely connect
your GitHub to your GitBash – git push -u origin maser : this will push your file to GitHub
and after it’s done go to GitHub and you see compare & pull request to add the file to GitHub
Step 3: - Go to your Jenkins – click on new item and your File name – select Free Style project – clickon ok
Step 4 : - To execute GitHub project under Jenkins Go to dashboard – manage Jenkins – Manage Plugin –
Available – gitplugin – Install without restart - git Hub Integration – install without restart – go back to your
project
Step 5 : - Click on configure – Source code Managemen – click Git – repositoru URl – Go to Github cloud
path copy and paste in repository URL
Step 6 : - Go to Build Triggers – select poll SCM - * * * * * ( it menas Jenkins Job Runs every Single
Minute)
Step 7 : - click on apply and save
Step 8: - Go to Build Steps Execute Window Batch Command
And type the following
Javac hello.java
Java hello
Step 9 : - click on build now and go to console output to see the output
EXERCISE: - 10
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
Jenkins Pipeline: Jenkins Pipeline is defined using a Text File called as Jenkins file Pipeline
Implementation as a code using Groovy Domain Specific language to an Editor Pipeline is a code Which
have Set of stages that contain Steps to Execute pipeline
Steps to Execute Jenkins Pipeline:
Step 1: - Go to Dashboard – create new item – enter the item name – Type of project is pipeline – click on
ok
Step 2; - Go to configure – Go o Pipeline and select the pipeline as scripted pipeline (pipeline where the
code Is defined in Jenkins) – select apply and save
Step 3: - Click on Build Now and see the console Output – Display the status of the pipeline
Step 4: - Again Go to Configure – go to pipeline copy the default HelloWorld Script and paste it in the
Notepad to perform modifications
Plugins to be added to the project – Staging View – Staging view plugin – Job and stage Monitoring plugin
– pipeline API – Stage pipeline
Now create Jenkins pipeline with different Stages
Pipeline {
Agent any
Stages {
Stage (‘check validate’) {
Steps {
Echo ‘Iam Validating the code ‘
}}
Stage(‘Compilation’) {
Steps {
Echo ‘I am Compiling the code’
}}
Stage(‘Install’) {
Steps {
Echo ‘I am Installing the code’
}}
Stage(‘Deploy’)
{
Steps {
Echo ‘I am Deploying the code’
}
}
}
}
Second type of pipeline is declarative pipeline It has limited Predefined Structure
Step 1: - Go top GitHub cloud- Create a newrepository – name of repository – click on add a readme file and
click on create repository
Step 2: - Add a file – create new file – name of the file – and copy the code from notepad which you have
done previously – commit your new file
Step 3: - copy the path – go to Jenkins – Dashboard – new – name of your project and select pipeline –
Click on ok
Step 4: - go to pipeline – pipeline Script from SCM – SCM – Git and repository URL and paste it form Git –
Credentials – Your Credentials – Click on add – Click on Jenkins
Under Jenkins Credentials Provider: Jenkins -username- GitHub username and GitHub password – Id as
Git_Credentials- click on add
Step 5: - Branches to build - /master – Script path – filename of GitHub – click on apply and save
Step 6: - click on Build Now and see the console output