SlideShare a Scribd company logo
2
Most read
9
Most read
15
Most read
Jenkins Tutorial -DevOps Tool
Jenkins Tutorial
1. Introduction
Jenkins is a self-contained, open source automation server which can be used to automate all
sorts of tasks such as building, testing, and deploying software. Jenkins can be installed through
native system packages, Docker, or even run standalone by any machine with the Java Runtime
Environment installed. Jenkins is simply the old Hudson with a new name.
Jenkins is a software that allows continuous integration. Jenkins will be installed on a server
where the central build will take place. The following flowchart demonstrates a very simple
workflow of how Jenkins works.
1.1 Continuous Integration Workflow
Martin Fowler said “Continuous Integration is a software development practice where
members of a team integrate their work frequently, usually each person integrates at least daily
– leading to multiple integrations per day. Each integration is verified by an automated build
(including test) to detect integration errors as quickly as possible”
At a regular frequency (ideally at every commit), the system is:
1. Integrated – All changes up until that point are combined into the project
2. Built – The code is compiled into an executable or package
3. Tested – Automated test suites are run
4. Archived – Versioned and stored so it can be distributed as is, if desired
5. Deployed – Loaded onto a system where the developers can interact with it
Continuous Integration Tools
• Code Repositories : SVN, Mercurial, Git
• Continuous Build Systems : Jenkins, Bamboo, Cruise Control
• Test Frameworks : JUnit, Cucumber, CppUnit
• Artifact Repositories : Nexus, Artifactory, Archiva
1.2 Jenkins Tool Workflow
Jenkins is a Java based Continuous Build System Branched from Hudson, Runs in servlet
container (Glassfish, Tomcat). It is supported by over 400 plugins like SCM, Testing,
Notifications, Reporting, Artifact Saving, Triggers, and External Integration etc.
In 2005 – Hudson was first release by Kohsuke Kawaguchi of Sun Microsystems. 2010 –
Oracle bought Sun Microsystems Due to a naming dispute, Hudson was renamed to Jenkins
Oracle continued development of Hudson (as a branch of the original)
Key Features of Jenkins
• It will Generate test reports
• Jenkins can Integrate with many different Version Control Systems
• Jenkins will Deploys directly to production or test environments and many more
2. Jenkins Installation
Requirements
• Java 7 or Java 8 must be installed.
• Requires minimum RAM of 512MB
2.1 Installing Jenkins in Windows
1.Download Jenkins.war.(if it is downloaded in .zip format rename/change extension to .war)
2.Check Java is installed or not by typing java -version command in command prompt.
3.Open up a terminal in the download directory and run java -jar jenkins.war
4.Browse to http://localhost:8080 and enter highlated password to continue the installation
5.Next it will takes you to “Create First Admin User”, provide details & finish
6.It will opens the Jenkins Home page as below
We can also install Jenkins using Apache Tomcat also. Just download & Start the tomcat.
Upload the Jenkins.war in tomcat from admin panel. You can access by using
http://localhost:8080/jenkins
2.2 How to Change Jenkins Port number
Some times 8080 is busy with some other services. In that case we can change port to some
other number by using following steps
1.Press Ctrl+C on Jenkins command line to Stop the Service
2.It it is Jenkins.war Installation, Start Jenkins from cmd line using :
java -jar jenkins.war --httpPort=8081
3.If is tomcat Installation, open xml & change "--httpPort=8080" with new port number
3. Jenkins Configuration
We can configure Jenkins jobs based up on our requirement. For doing any configuration we
have to go to Manage Jenkins on the left menu of the Dashboards.
It contains following modules for configuration
We have to use the above configuration as per our requirement. As of now we don’t all of
them.we need some basic configuration required for working with Jenkins.
For that we need to Install and Configure below Tools/ Softwares
• Install Java
• Install Git (just download & install as normal software)
• Install Maven
• Install Ant
3.1 Configure System
Here we can manage paths to the various tools to use in builds, such as the JDKs, the versions
of Ant and Maven, as well as security options, email servers, and other system-wide
configuration details. When plugins are installed. Jenkins will add the required configuration
fields dynamically after the plugins are installed.
For Configure System we have to navigate to Manage Jenkins →Select Configure System
3.2 Configure Global Security
It is used for SecuringJenkins & define who is allowed to access/use the system.
The Configure Global Security page has two sections in which you:
• Set the security realm to determine who is allowed access
• Set the authorization to determine what each user is allowed to do
Jenkins’ Own User Database
This is the simplest authentication scheme–Jenkins maintains its own independent user
database. People can sign up for their own accounts, and you as the administrator decide who
can do what in Jenkins.
1. Go to the Jenkins dashboard, usu
ally http://server:8080 or http://server/jenkins:8080, where server is the host on which
Jenkins is running
2. Select Manage Jenkins, then Configure Global Security
3. Click Enable Securit The page will expand to offer a choice of access control.
4. Select Jenkins’ own user database & check mark next to Allow users to sign up
5. Continue with Authorization, below. In particular, do not forget to press the Save button
at the bottom of the page.
3.3 Global Tool Configuration
The Global Tool Configuration lets you define variables that can be managed centrally but used
in all of your build jobs. You can add as many properties as you want here, and use them in your
build jobs. Jenkins will make them available within your build job environment, so you can
freely use them within your Ant and Maven build scripts. Note that you shouldn’t put
periods (“.”) in the property names, as they won’t be processed correctly.
3.3.1 Java Configuration in Jenkins
1.Navigate to Manage Jenkins → Global Tool Configuration→JDK Installations →Add JDK
2.Set JDK Name. For Ex: JDK_1.8.0_111 (uncheck Install automatically)
3.Set JAVA_HOME directory path. For Ex: C:Program FilesJavajdk 1.8.0_111
4.Apply & Save.
3.3.2 Apache Maven Configuration in Jenkins
1.Navigate to Manage Jenkinks→ Global Tool Configuration→ Maven Installations→ Add Maven
2.Set Maven Name. For Ex: apache-maven-3.3.9 (uncheck Install automatically)
3.Set MAVEN_HOME directory path. For Ex: C: apache-maven-3.3.9
4.Apply & Save.
3.4 Reload Configuration from Disk
This Option will Discard all the loaded data in memory and reload everything from file system.
Useful when you modified config files directly on disk. Be careful using this, it won’t display any
page directly deletes the data when you click on OK button on alert message!!
3.5 Manage Plugins
Here we can Add, remove, disable or enable plugins that can extend the functionality of
Jenkins.
We can install the plugins directly from Available plugins tab, and uninstall when ever you want
How to add Jenkins Plugins manually
Some time proxy settings won’t allow us to contact Jenkins CI server directly. In those cases we
can install Jenkins plugins by downloading them manually. Follow below Steps to do so
1.Go to https://plugins.jenkins.io/
2.Search the plugin you want & click on plugin page
3.on the right side of the page, click on Archives, select latest ,it will download plugin in .hpi
format
4.Now go to Manage Plugins→ Advanced tab come down & upload plugin
3.6 Manage Users
Create/delete/modify users that can log in to this Jenkins
3.7 Jenkins CLI
Access/manage Jenkins from your shell, or from your script. You can access various features in
Jenkins through a command-line tool. See the Wiki for more details of this feature.To get
started, download jenkins-cli.jar, and run it as follows:
java -jar jenkins-cli.jar -s http://localhost:8080/ help
3.8 Script Console
Executes arbitrary script for administration/troubleshooting/diagnostics.
3.9 Install as Windows Service
Installs Jenkins as a Windows service to this system, so that Jenkins starts automatically when
the machine boots.
3.10 Manage Nodes
Add, remove, control and monitor the various nodes that Jenkins runs jobs on.
And also we have some other things in manage Jenkins, they are
• Manage Old Data: remove remnants from old plugins and earlier versions.
• System Information: Displays various environmental information to assist trouble-
shooting.
• System Log: system log captures output from java.util.logging output related to Jenkins.
• Load Statistics : Check your resource utilization
• Prepare for Shutdown: Stops executing new builds, so that the system can be shut
down safely.
3.11Jenkins Pipeline
Jenkins Pipeline is a suite of plugins which supports implementing and integrating continuous
delivery pipelines into Jenkins
Typically, this “Pipeline as Code” would be written to a Jenkinsfile and checked into a project’s
source control repository, for example:
Jenkinsfile (Declarative Pipeline)
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building..'
}
}
stage('Test') {
steps {
echo 'Testing..'
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
}
}
}

More Related Content

PPTX
Power of Azure Devops
ODP
An Introduction To Jenkins
PPTX
Software testing ppt
PDF
Agile Scrum Training Process
PPTX
Agile methodology
PDF
software engineering
PPTX
Cryptocurrency
PDF
Agile Methodology
Power of Azure Devops
An Introduction To Jenkins
Software testing ppt
Agile Scrum Training Process
Agile methodology
software engineering
Cryptocurrency
Agile Methodology

What's hot (20)

PPTX
Introduction to jenkins
PPTX
PPTX
Jenkins tutorial for beginners
PPTX
Jenkins CI
PPTX
Jenkins Introduction
PPTX
Jenkins tutorial
PPT
Jenkins Overview
PPT
Maven Introduction
PPTX
Jenkins presentation
PPTX
Jenkins CI presentation
PPTX
Ansible presentation
PDF
Ansible
PDF
Jenkins tutorial
PDF
ODP
Introduction to Ansible
PDF
Jenkins
ODP
Introduction to Nginx
PDF
Ansible - Hands on Training
PDF
Jenkins Pipelines
PDF
Gradle Introduction
Introduction to jenkins
Jenkins tutorial for beginners
Jenkins CI
Jenkins Introduction
Jenkins tutorial
Jenkins Overview
Maven Introduction
Jenkins presentation
Jenkins CI presentation
Ansible presentation
Ansible
Jenkins tutorial
Introduction to Ansible
Jenkins
Introduction to Nginx
Ansible - Hands on Training
Jenkins Pipelines
Gradle Introduction
Ad

Similar to Jenkins Tutorial.pdf (20)

PPTX
Jenkins.pptx
PPTX
Maven TestNg frame work (1) (1)
PPTX
Maven TestNg frame work (1) (1)
PDF
How to Install and Configure Jenkins on Centos 7
PDF
454976614-Jenkins-Cheat-Sheet-pdf.pdf hoja de ayuda
PPTX
Drupal Continuous Integration with Jenkins - The Basics
PDF
OSDC 2017 | Automating Jenkins by Julien Pivotto
PDF
OSDC 2017 - Julien Pivotto - Automating Jenkins
DOCX
Integrate UFT with Jenkins Guide
PPTX
Drupal Continuous Integration with Jenkins - Deploy
PDF
Build server
PDF
Scaling Jenkins Devops presentation
PPTX
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
PDF
Introduction To Jenkins - SpringPeople
PDF
Jenkins-Resource un documennt ingénierie.pdf
PPTX
How to push to production a project with 100+ plugins in less than 10 minutes
PPTX
Selenium Training in Chennai
PDF
Jenkins log monitoring with elk stack
PPTX
Build using jenkins on rtc repository
PPTX
varun JENKINS.pptx
Jenkins.pptx
Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)
How to Install and Configure Jenkins on Centos 7
454976614-Jenkins-Cheat-Sheet-pdf.pdf hoja de ayuda
Drupal Continuous Integration with Jenkins - The Basics
OSDC 2017 | Automating Jenkins by Julien Pivotto
OSDC 2017 - Julien Pivotto - Automating Jenkins
Integrate UFT with Jenkins Guide
Drupal Continuous Integration with Jenkins - Deploy
Build server
Scaling Jenkins Devops presentation
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Introduction To Jenkins - SpringPeople
Jenkins-Resource un documennt ingénierie.pdf
How to push to production a project with 100+ plugins in less than 10 minutes
Selenium Training in Chennai
Jenkins log monitoring with elk stack
Build using jenkins on rtc repository
varun JENKINS.pptx
Ad

Recently uploaded (20)

PDF
Complications of Minimal Access Surgery at WLH
PDF
Basic Mud Logging Guide for educational purpose
PDF
Sports Quiz easy sports quiz sports quiz
PDF
01-Introduction-to-Information-Management.pdf
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Pre independence Education in Inndia.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
Complications of Minimal Access Surgery at WLH
Basic Mud Logging Guide for educational purpose
Sports Quiz easy sports quiz sports quiz
01-Introduction-to-Information-Management.pdf
Computing-Curriculum for Schools in Ghana
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPH.pptx obstetrics and gynecology in nursing
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Renaissance Architecture: A Journey from Faith to Humanism
TR - Agricultural Crops Production NC III.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
GDM (1) (1).pptx small presentation for students
Pre independence Education in Inndia.pdf
Final Presentation General Medicine 03-08-2024.pptx

Jenkins Tutorial.pdf

  • 1. Jenkins Tutorial -DevOps Tool Jenkins Tutorial 1. Introduction Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks such as building, testing, and deploying software. Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with the Java Runtime Environment installed. Jenkins is simply the old Hudson with a new name. Jenkins is a software that allows continuous integration. Jenkins will be installed on a server where the central build will take place. The following flowchart demonstrates a very simple workflow of how Jenkins works. 1.1 Continuous Integration Workflow Martin Fowler said “Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily – leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible” At a regular frequency (ideally at every commit), the system is: 1. Integrated – All changes up until that point are combined into the project 2. Built – The code is compiled into an executable or package 3. Tested – Automated test suites are run 4. Archived – Versioned and stored so it can be distributed as is, if desired 5. Deployed – Loaded onto a system where the developers can interact with it
  • 2. Continuous Integration Tools • Code Repositories : SVN, Mercurial, Git • Continuous Build Systems : Jenkins, Bamboo, Cruise Control • Test Frameworks : JUnit, Cucumber, CppUnit • Artifact Repositories : Nexus, Artifactory, Archiva 1.2 Jenkins Tool Workflow Jenkins is a Java based Continuous Build System Branched from Hudson, Runs in servlet container (Glassfish, Tomcat). It is supported by over 400 plugins like SCM, Testing, Notifications, Reporting, Artifact Saving, Triggers, and External Integration etc. In 2005 – Hudson was first release by Kohsuke Kawaguchi of Sun Microsystems. 2010 – Oracle bought Sun Microsystems Due to a naming dispute, Hudson was renamed to Jenkins
  • 3. Oracle continued development of Hudson (as a branch of the original) Key Features of Jenkins • It will Generate test reports • Jenkins can Integrate with many different Version Control Systems • Jenkins will Deploys directly to production or test environments and many more 2. Jenkins Installation Requirements • Java 7 or Java 8 must be installed. • Requires minimum RAM of 512MB 2.1 Installing Jenkins in Windows 1.Download Jenkins.war.(if it is downloaded in .zip format rename/change extension to .war)
  • 4. 2.Check Java is installed or not by typing java -version command in command prompt. 3.Open up a terminal in the download directory and run java -jar jenkins.war 4.Browse to http://localhost:8080 and enter highlated password to continue the installation
  • 5. 5.Next it will takes you to “Create First Admin User”, provide details & finish 6.It will opens the Jenkins Home page as below We can also install Jenkins using Apache Tomcat also. Just download & Start the tomcat. Upload the Jenkins.war in tomcat from admin panel. You can access by using http://localhost:8080/jenkins
  • 6. 2.2 How to Change Jenkins Port number Some times 8080 is busy with some other services. In that case we can change port to some other number by using following steps 1.Press Ctrl+C on Jenkins command line to Stop the Service 2.It it is Jenkins.war Installation, Start Jenkins from cmd line using : java -jar jenkins.war --httpPort=8081 3.If is tomcat Installation, open xml & change "--httpPort=8080" with new port number 3. Jenkins Configuration We can configure Jenkins jobs based up on our requirement. For doing any configuration we have to go to Manage Jenkins on the left menu of the Dashboards.
  • 7. It contains following modules for configuration We have to use the above configuration as per our requirement. As of now we don’t all of them.we need some basic configuration required for working with Jenkins. For that we need to Install and Configure below Tools/ Softwares • Install Java • Install Git (just download & install as normal software) • Install Maven • Install Ant 3.1 Configure System Here we can manage paths to the various tools to use in builds, such as the JDKs, the versions of Ant and Maven, as well as security options, email servers, and other system-wide configuration details. When plugins are installed. Jenkins will add the required configuration fields dynamically after the plugins are installed.
  • 8. For Configure System we have to navigate to Manage Jenkins →Select Configure System 3.2 Configure Global Security It is used for SecuringJenkins & define who is allowed to access/use the system. The Configure Global Security page has two sections in which you: • Set the security realm to determine who is allowed access • Set the authorization to determine what each user is allowed to do Jenkins’ Own User Database This is the simplest authentication scheme–Jenkins maintains its own independent user database. People can sign up for their own accounts, and you as the administrator decide who can do what in Jenkins. 1. Go to the Jenkins dashboard, usu ally http://server:8080 or http://server/jenkins:8080, where server is the host on which Jenkins is running 2. Select Manage Jenkins, then Configure Global Security 3. Click Enable Securit The page will expand to offer a choice of access control. 4. Select Jenkins’ own user database & check mark next to Allow users to sign up 5. Continue with Authorization, below. In particular, do not forget to press the Save button at the bottom of the page.
  • 9. 3.3 Global Tool Configuration The Global Tool Configuration lets you define variables that can be managed centrally but used in all of your build jobs. You can add as many properties as you want here, and use them in your build jobs. Jenkins will make them available within your build job environment, so you can freely use them within your Ant and Maven build scripts. Note that you shouldn’t put periods (“.”) in the property names, as they won’t be processed correctly. 3.3.1 Java Configuration in Jenkins
  • 10. 1.Navigate to Manage Jenkins → Global Tool Configuration→JDK Installations →Add JDK 2.Set JDK Name. For Ex: JDK_1.8.0_111 (uncheck Install automatically) 3.Set JAVA_HOME directory path. For Ex: C:Program FilesJavajdk 1.8.0_111 4.Apply & Save. 3.3.2 Apache Maven Configuration in Jenkins 1.Navigate to Manage Jenkinks→ Global Tool Configuration→ Maven Installations→ Add Maven 2.Set Maven Name. For Ex: apache-maven-3.3.9 (uncheck Install automatically) 3.Set MAVEN_HOME directory path. For Ex: C: apache-maven-3.3.9 4.Apply & Save.
  • 11. 3.4 Reload Configuration from Disk This Option will Discard all the loaded data in memory and reload everything from file system. Useful when you modified config files directly on disk. Be careful using this, it won’t display any page directly deletes the data when you click on OK button on alert message!! 3.5 Manage Plugins Here we can Add, remove, disable or enable plugins that can extend the functionality of Jenkins. We can install the plugins directly from Available plugins tab, and uninstall when ever you want How to add Jenkins Plugins manually Some time proxy settings won’t allow us to contact Jenkins CI server directly. In those cases we can install Jenkins plugins by downloading them manually. Follow below Steps to do so 1.Go to https://plugins.jenkins.io/ 2.Search the plugin you want & click on plugin page 3.on the right side of the page, click on Archives, select latest ,it will download plugin in .hpi format
  • 12. 4.Now go to Manage Plugins→ Advanced tab come down & upload plugin 3.6 Manage Users Create/delete/modify users that can log in to this Jenkins 3.7 Jenkins CLI
  • 13. Access/manage Jenkins from your shell, or from your script. You can access various features in Jenkins through a command-line tool. See the Wiki for more details of this feature.To get started, download jenkins-cli.jar, and run it as follows: java -jar jenkins-cli.jar -s http://localhost:8080/ help 3.8 Script Console
  • 14. Executes arbitrary script for administration/troubleshooting/diagnostics. 3.9 Install as Windows Service Installs Jenkins as a Windows service to this system, so that Jenkins starts automatically when the machine boots.
  • 15. 3.10 Manage Nodes Add, remove, control and monitor the various nodes that Jenkins runs jobs on. And also we have some other things in manage Jenkins, they are • Manage Old Data: remove remnants from old plugins and earlier versions. • System Information: Displays various environmental information to assist trouble- shooting. • System Log: system log captures output from java.util.logging output related to Jenkins. • Load Statistics : Check your resource utilization • Prepare for Shutdown: Stops executing new builds, so that the system can be shut down safely. 3.11Jenkins Pipeline Jenkins Pipeline is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins Typically, this “Pipeline as Code” would be written to a Jenkinsfile and checked into a project’s source control repository, for example: Jenkinsfile (Declarative Pipeline) pipeline { agent any stages { stage('Build') { steps { echo 'Building..' } } stage('Test') { steps { echo 'Testing..' }
  • 16. } stage('Deploy') { steps { echo 'Deploying....' } } } }