Jenkins Agenda 1 Installing Jenkins setting up configuration 2 Security LDAP authorization 3 How to schedule a job 4 integration Integration with GIT GITHUB Integration with Ant Integration with Maven Integration with Ansible Integration with Nexus 6 how to schedule backups 7 restore from backups 8 Configure Slaves 9 Monitoring the workload 10 Managing plugins 5 Troubleshooting location of log files of startup failed plugin and etc Jenkins provides continuous Integration services for software deployment What is Jenkins Leading open source continuous Integration server Highly configurable system by itself 400 community developed plugins Multi platform Easy to use Free Open source https jenkins io index html Features Originally started as Hudson then renamed as Jenkins leading open source continuous integration server Based on tomcat Flexibility Jenkins is a highly configurable system by itself 400 community developed plugins Less Effort to Integrate existing existing test buckets Multi platform Easy to use Free Open Source Documentation https jenkins io index html Failing is Ok but we need to fail fast Catching a bug in test costs less than catching in production Code quality review Proper documentation This can be done using custom scripts but as the project increases it is difficult to maintain There was split in Hudson when oracle took over SUN 90 Hudson and Jenkins are same If A fails do B if A passes do C jobs can be dependent like a pipeline What is a build Build has many components one of them is version control No matters how many times a code changes build has to happen code has to be compiled Build can be started by Commit a version in version control Scheduling via cron like mechanism Tests can be executed every week hour etc Build also has to be tested Communicate the results to all stake holders Product owner System admin QA Developer History can be maintained Continuous delivery vs Continuous deployment Continuous Deployment deploying the product to customers continuously without approval this is automatic Continuous delivery approval is needed ready to deploy This is not automatic Test cases have to be automated for Continuous Integration Download Jenkins Download LTS long term support not weekly build which is not safe Download native packages not war packages Jenkins rpm comes with webserver Download Stable Jenkins rpm from http pkg jenkins ci org redhat stable 1 Install it using rpm ivh root ctx3p12 MISC rpm ivh jenkins 2 9 1 1 noarch rpm warning jenkins 2 9 1 1 noarch rpm Header V4 DSA SHA1 Signature key ID d50582e6 NOKEY Preparing 100 Updating installing 1 jenkins 2 9 1 1 100 2 Install Java using yum 3 Start the Jenkins service root ctx3p12 MISC sudo systemctl start jenkins service root ctx3p12 MISC cat var lib jenkins secrets initialAdminPassword a45c1a99da7c49518ce07b7db91950e4 root ctx3p12 MISC firewall cmd permanent zone public add port 8080 tcp to open port 8080 on Jenkins server Jenkins by default listens on port 8080 So open http FQDN 8080 To change port etc sysconfig jenkins http port to 8089 jenkins home var lib jenkins config xml How to install sudo yum y install java java is a prerequisite for Jenkins yum whatprovides service sudo wget O etc yum repos d jenkins repo http pkg jenkins ci org redhat jenkins repo Downloads the repo file from Jenkins site sudo rpm import https jenkins ci org redhat jenkins ci org key Imports the key from Jenkins site for authentication sudo yum install jenkins Downloads and installs the Jenkins packages from Jenkins repository sudo systemctl status jenkins service Start the service and check the status it should be Active Download Jenkins Install it Configure plugins Install all of them Install GIT related them Installing all may slow down Jenkins Its not recommended to enable auto refresh URL restart will restart Jenkins Manage Jenkins Configure global security click on enable security Authorization any one can do any thing Security realm Jenkins own user database LDAP is for corporate security to sign up using intranet id Manage Jenkins project based authority enable everything for admin enable all permissions Setup security Click on Enable security Difference between save and apply Apply will remain in the same save will go back to previous page Manage Jenkins configure system No of executors no of core you have on CPU GIT hub server create user id in git hub server Add git hub server Go to client Git clone https githubg com RSCTFVT Commit back from SVN Add a file here Git add Git commit m some commit Jenkins was developed by Kohsuke Kawaguchi Backup of Jenkins 1 Take backup of home directory using tar cvf command tar cvf jenkins backup 21dec tar Jenkins gzip jenkins backup 21dec tar then copy it to other machine Incase of crash extract this file in newly created Jenkins server 2 Take backup of single job using xml http ctx3p11 in company com 8080 job RSCTBAT config xml open a job with config xml extension and take backup in a file After installation root jupiter vm751 cat var lib jenkins secrets initialAdminPassword 1b5561f487c14ea3b9c6c386eca33cfc Configuring Slaves GIT Git is becoming popular in Devops world Git is to keep track of changes Ansible puppet chef vagrant files we store on GITHUB Why GIT 1 Build Release devops eng works with developers 2 For storing automation scripts 3 Open source so many open source projects are hosted on GIT Linux chef puppet etc System admins take backup by copying Cp file file 1 Cp file 1 file 2 Its difficult to track Or we can name with date That is also difficult to track If there are many scripts how to handle There should be a centralized location to keep track of all changes that is called version control system Don t keep track Save numbered zip file Fomal version control Diff windiff can see the difference Even that is difficult Developed by Linux torwalds keep track of source code Used for just for source code Do not use for file storage Its fast Don t need access to server Good at merging simultaneous changes Everyone is using it Bitbucket is alternative GIT HUB to store our scripts Singup to github Just give username and password Login to it Create new repository Other CI tools Microsoft tfs team foundation server Hudson Bamboo Mercuyrail Configuring slaves on the Jenkins master 1 Create jenkins user on the slave and set the password to slave as root passwd Jenkins useradd d home jenkins c jenkins user s bin bash m jenkins 2 Configure password less authentication on the
View Full Document