0% found this document useful (0 votes)
49 views54 pages

Devops Manual

devops

Uploaded by

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

Devops Manual

devops

Uploaded by

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

LAB MANUAL

CONTINUOUS INTEGRATION AND CONTINUOUS


DELIVERY USING Devops LAB

DEPARTMENT OF CSE

SRK INSTITUTE OF TECHNOLOGY

ACADEMIC YEAR 2022-23

(III BTech I Sem R20Regulation)

Prepared By

Dr.A.Radhika
Course Outcomes:

Student will be able to:

1)Understand the why, what and how of DevOps adoption

2)Attain literacy on Devops

3)Align capabilities required in the team

4)Create an automated CICD pipeline using a stack of tool

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 .

1.Software Engineering and Agile Software Development

Software Engineering: -

Need of software engineering: -

1. Vision of the project and outcomes

2. Clarity on requirements

3. Analysis and design

4. Development

5. Testing

6. Deployment and maintenance.

Software Engineering Concept: -

Software Crisis: -

1. Time and cost slippage

2. Failure at customer’s site

3. Untraceable errors after delivery

4. Difficulty in maintenance

5. Information leak when multiple stakeholders at play.

Definition: -

It is the application of a systematic, disciplined, quantifiable approach to thedevelopment, operation


maintenance of software i.e., the application ofengineering to software.

Life cycle: -

1.Requirements: -capture requirements from stake holders

2.Design: -Arrive at the high-level design of software

3.Coding: -Translate design to code

4.Testing: -Validate requirements against code developed

5.Deployment: -Deploy software in customer environment

6.Maintenance: -Support customer on post-production issues


Models: -

A conceptual framework which describes activities in a project end-to-end

1.Waterfall

2.Prototyping

3.Spiral

4.Rapid application Development

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

Agile software Development: -

Why Agile:

1. Responding to changes quickly with quality

2. Quick time to market

3. Develop software amidst requirements volatility

Benefits: -

1. Faster time to market

2. Quality software

3. Adopt to changes quickly

4. Sustainable development admits uncertainty


Principles: -

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.

4. Businesspeople and developers must work together daily throughoutthe project.

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.

7. Working software is the primary measure of progress.

8. Agile processes promote sustainable development. Thesponsors, developers and users should be able to
maintain a constantpace indefinitely.

9. Continuous attention to the technical excellence and good designenhances 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-isessential.


EXERCISE: 2
Explore the working knowledge of using extreme automation through XP
programming practices of test first development, refactoring and automating test case
writing.
Extreme Programming:

Get a working knowledge of using extreme automation through XP Programming practices of test first
development, refactoring and automating test case writing.

Extreme Programming (XP):

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.

Extreme Programming Concepts:

1. Quality Improvements
2. Process Improvement
3. Customer Satisfaction Improvements

Advantages:

1. Focuses on Key activities


2. Cost and time efficiencies
3. Reduces risks
4. Uncomplicated
5. Transparency
6. Ongoing feedback
7. Focuses on customer needs
8. Equal Accountability

Roles:

1. Customer: Asks for his requirements


2. Tracker: Checks whether the task is going on properly
3. Developer: Understand customer requirements and start coding
4. Coach: Guides the development team and customer to go in a proper way
5. Communication: Communicating with customer properly
6. Simplicity: Easy to understand

7. Feedback

8. Courage: Discuss about a project to the company head

9. Respect

Practices:

● Whole team
● Sir together
● Informative workspace
● Energized work
● Pair Programming
● Stories
● Weekly and quarterly cycles
● Slack
● Ten-minute build

Extreme Programming use case:

● All activities performed throughout the development


● Iteratively builds
● Resilience
● Enable changes

Planning:

● Plan
● Design
● Code
● Test

Feedback:

● Customer acceptance tests


● Project Manager

Planning Game Practices:

● Organized meeting
● Ensures quality improves design
● Promotes effective project management
● Two parts-release planning and iteration planning

Release Planning:

● Customer
● Software developer

Release Planning -Exploration Phase:

● What software
● How it works

Planning -Commitment phases:

1. Functionality
2. Release date

Game parts and phases

● 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

Planning -Steering phase

● Adding
● Reviewing
● Revising

Iteration Planning Exploration:

● Refine user story card requirements


● Translate requirements into tasks
● Create task cards

Iterative planning -Commitment phase:

● Assign tasks
● Determine duration

Iteration Planning-Steering phase:

● Complete tasks
● Validate design
● Evaluate design
● Adjust

Pair Programming

● Two programmers
● Shared workstation
● Regular role switching

Benefits

● Increase quality of code


● Grows collective team knowledge
● Enables skills transfer to more experienced development
● Reduce coordination efforts
● Improves coding resiliency

Skills level:

● Beginner
● Intermediate
● Advanced
Disadvantages:

● Requires active engagement by both participant


● Potential cost increase
● Requires good communication
● Requires good relationship between the participants

Code Check Options:

● 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

Effective of Pair Programming

● Can be advantageous if used correctly


● Requires understanding different styles and how they each work
● Different scenarios require different styles of Pair Programming
● Six common styles of Pair Programming

Back-Seat Navigation:

● Tactical focus
● Both tactical and strategic

Ping -Pong Pairing:

● One developer purposely writes a falling test


● Second developer focuses on getting it pass
● Then roles switch

Test Driven Development Benefits:

● Design
● Coding
● Testing

Test Driven Development Benefits:

● Helps you build every buy notification capability


● Increased design efficiency
● Provides refactor confidence
● Enables collaboration
● Reduces debugging and development time
Levels:

● Acceptance Test Driven Development


● Developer Test Driven Development

Comparing Testing Approaches:

● Ensures confirmatory -level testing


● Verifies system meets defined requirements
● Focuses on production code to verify testing
● Tests every lines of code
● Traditional Testing
● Focuses on test case design

Considerations:

● Not fool proof


● Requires full team collaboration
● Slower process

Source Control Management (SCM) and Tools:

● Tracking and managing


● Ensuring version control

Benefits:

● Maintains single source


● Facilities collaboration
● Accelerates velocity

SCM Best practices:

● Select the most appropriate system for your needs


● Store your code directly in the system
● Always pull latest versions of code
● Ensures you commit code often, including details
● Make use of branches for parallel work

SCM Tools:

● GIT - Set of Commands

-Git hub repository

● Perforce Metrix core


● Sub Version
● Clear cases
● Team foundation server
● Mercurial

Git Hub Steps:

1. Open browser https://GitHub.com


2. Creates repository of repository name is your name
3. A repository with a name xxxxx will be created. Now, In this repository it have one file readme mid..
Readme files lists and all the fields in current directory
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

(i) Clone to repository on the local machine

(ii) Now download GitHub desktop

(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:

● Prevent code overlap


● Remote Integration issues

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

Continuous Integration in Actions :


Coding standard practice and Benefits

Coding Standards

● Consistency
● Manageability

Coding standards benefits:

● Reduced rates of failures


● Development time optimization
● Simplified debugging
● Cost controls

Coding standard categories:

● Mandatory
● Guidelines
● Recommendations

Coding standard Elements:

● Format
● Code structure
● Naming conventions
● Error Handling
● Comments

Coding standard Best Practices:

● Understand the purpose


● Consider your industry
● Comply with rules and follow recommendations
● Describe intent
● Update carefully
● Consider open vs. closed
● Prioritize rules
● Plan for deviations

Collective code Ownership:

● Team produces quality product


● Every team member equality responsible

Knowledge Sharing:

● Eliminate critical knowledge silos


● Promotes collective learning

Code Excellence:

● Increased quality
● Style efficiency
Remove dependencies on Individuals:

● Eliminates the risk of the lottery "effect"


● Promotes collective responsibilities

Efficient code Reviews:

One knows truly knows solution

Greater learning Scope:

● Continuous learning
● Shorter learning time

Collective code Ownership Disadvantages:

● No Individual Ownership
● Relies on team expertise
● May hinder motivation
● Not suited for Specialized functions

Code Refactoring:

● Editing without changes to function


● Code efficiency
● Prevent bugs in future
● Avoid code rot

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

Refactoring Best Practices:

● Decouple (test you know)


● Consider infrastructure
● Plan

Refactoring in Agile Software Development

● Improves software consistency


● Helps fix bad code
● Increases time efficiencies
● Increases Simplicity
● Evolves iteratively

The problems

● Older code with duplication


● Updates by many developers over years
● Multiple variations for similar products
● Difficult to understand
● Starting to experience unintended side effects with new updates

Restructuring:

● Reduce duplication
● Resize classes and methods

Addressing Duplication:

● Extract
● Replace

Simplifying

● Adding new code in the future


● Replacing code later

Small Releases:

● Deliver value fast


● Quick feedback
● Quick wins for team
● Reduces risks
● Build adaptability

Prepare

● How iteration occur


● Time intervals

Meet & Discuss

● Evaluate
● Identify team goals and strategies
Iteration Details

● Value to customer
● Maximum two weeks between iterations
● Quality

Apply Lessons Learned

● Incorporate feedback
● Experiment
● Add new features

System Metaphor

Changing standard project architecture names to easily understood non -technical terms of phrases

System Metaphor Goals

● Common vision
● Generativity
● Shared vocabulary
● Architecture

Advantages

● Enables easier system understanding


● Enables model comprehension
● Expands range

Disadvantages:

● May break cultural protocols


● May make users avoid systems
● May create conflict
● May lead to using bad designs

Best Practices:

● Single view
● One structure type
● Clear design guidance
● System properties focus
● Shared experience

Applying the 40 - hour work week

● 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

● Team members work best when we'll - rested


● Requires frequent code merging
● Quality code is required
● Frequent code development minimizes risk

Benefits

● Creative thinking time


● Time for quality
● Cross - training
● Problem exposure

Considerations

● Development
● Quality
● Delivery
● Improvement

Determining sustainable pace

● 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

These activities are done in continuous integration of pipeline.


Test and test data management automation:
 Functionality test
 Test and test data management
 Performance test
 Security test

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.

2. End user dashboard


 Provide code as well as API to executable.
Tools stack and its implementation:
1. Continuous integration and activities involved.

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

It is an Open source, free and powerful tool.


 Unit test: unit

As it is integrated with the eclipse IDE


 Build automation: Maven

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 7: - now type git push -u origin master


This command will push form working current directory to remote cloud repository
Step 8: - Now go to git hub cloud now we have a request as compare and pull request to the new branch

Convert Cloud repository to Local Repository


Step 1: - Go to Git Bash and type dir. to see the directories in it and now create a directory local using
mkdir local
Step 2: - Now to go to where the directory was using cd local

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 7: - and then go to google and then type http://localhost:9000


Step 8: - Open new Command project copy the path of java project C:/users/Dell/eclipse-workspace/static
void main and enter sonar-scanner.bat
Step 9: - After success go to your SonarQube you have window that your project uploaded into it .
Exercise: - 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.
Step 1: - Maven is a open source which can be downloaded formhttp://maven.apache.org/download.cgi
And go to environment variables and click on new M2_HOME and copy the path up to bin
Step 2: - Go to eclipse IDE and click on new and go to other and select org. Apache. maven. archetypes
And click on next name group id and artificial id and click on finish

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

After this click on suggested plugins

Add login credentials -username: admin password: adminemail: admin@admin


After this click on save and continue and a home page of Jenkins will be opened
Exercise: - 8
Create a Free Style project in Jenkins by integrating Maven Project and executing the
project in Jenkins IDE.
Step 1: - Open Jenkins – create new item – File name – Select Free Style Project and click on ok

Step 2: - Under General Description – Execution of maven Project


Step 3: - Installation of Plugins. go to dashboard – Manage Jenkins – Global tool Configuration
1.) Adding JDK – JDK – Name – JDK 11 and Java_HOME as - C:\Program Files\Java\jdk-11.0.17

2.) Add Maven – Maven name – M2_HOME and Maven_HOME:C:\Users\DELL\Downloads\apache-


maven-3.8.6-bin\apache-maven-3.8.6
Step 4: Now again go to dashboard – project – click on your project name – go to build steps – Invoke top
level Maven targets – Under Goals – clean install

Step 5: - Click on advanced Enter the POM path –


C:\Users\DELL\eclipse-workspace\mavenapplication\pom.xml

Step 6: - click on Build Now potion to Run Maven Project on Jenkins


Step 7: - Click on Console output to see the Output Screen
Exercise: - 9
Develop a Jenkins application that will integrate with the code in Github
Step 1: - open your GitHub login and click on new and repository name and click on add a readme file and
click on Create repository

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

You might also like