Jenkins Tutorial
Jenkins Tutorial
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. 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
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)
2. Jenkins Installation
Requirements
3.Open up a terminal in the download directory and run java -jar jenkins.war
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
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.
• Install Java
• Install Git (just download & install as normal software)
• Install Maven
• Install Ant
We can install the plugins directly from Available plugins tab, and uninstall when ever you want
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
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:
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building..'
}
}
stage('Test') {
steps {
echo 'Testing..'
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
}
}
}