Introduction to

Jenkins

by
Rejah Rehim


JenkinS

  • Open source continuous integration tool
  • Written in Java
  • Forked from Hudson after a dispute with Oracle
  • Server-based system running in a servlet container such as Apache Tomcat


supported SCM tools

  • CVS
  • Subversion
  • Git
  • Mercurial
  • Perforce
  • Clearcase 
  • RTC

executeS


  • Apache Ant
  • Apache Maven
  • Arbitrary shell scripts 
  • Windows batch commands

Builds can be started by


  • Triggering  commit in a version control system
  • Scheduling via a cron-like mechanism
  • Building when other builds have completed
  • Requesting a specific build URL
  • Manually from Jenkins web interface

INSTALLATION


On Debian-based distributions, such as Ubuntu, you can install Jenkins through apt-get
  • wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
  • sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
  • sudo apt-get update
  • sudo apt-get install jenkins

INSTALLATION

On Fedora-based distributions, such as Red Hat Enterprise Linux (RHEL), CentOS or Scientific Linux




  • sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
  • sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
  • sudo yum install jenkins


INSTALLATION

Jenkins as a Windows service

  • Requires Microsoft .NET framework version 2.0
  • Start Jenkins by running "java -jar jenkins.war"
  • Connect to Jenkins by going to the following URL http://localhost:8080/
  • Once Jenkins is started, look for the "Install as Windows Service" link in the "Manage Jenkins" page 


CONFIGURING Jenkins

Securing

Installation is insecure and everyone can access it
Go to Manage Jenkins > Setup Security 


Then enable the security by checking

Set it to use Jenkins's own user database

Go for the Matrix-based security

Make sure Anonymous only has the Read right under the View group


Adding  Job

Click the New Job link

Create a freestyle project

Press Ok and on the next page, add build step



For the Command field, fill
Click the Build Now button to  run build


Build history

Console Output

Schedule Your Job

Jenkins can run your job on-demand or at a specific time

This leads you to the configuration page as shown 
Now this input field accepts the Crontab syntax, so setting it to @hourly runs it every hour and * * * * * runs it every minute.

Plugins

Install plugins

The simplest way is by going to your installation's management screen and clicking Manage Plugins

  • Go to the Available tab. You'll find the plugin you'd like to install
  • Select the checkbox 
  • Install 


Install plugins


By hand


Save the downloaded *.hpi/*.jpi file into the $JENKINS_HOME/plugins directory. 

You will then need to restart Jenkins
 

THANKS

Made with Slides.com