Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Jenkins

Introduction to Jenkins

Jenkins is a free and open source automation server written in Java. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery. It is a server-based system that runs in servlet containers such as Apache Tomcat. It supports version control tools, including AccuRev, CVS, Subversion, Git, Mercurial, Perforce, TD/OMS, ClearCase and RTC, and can execute Apache Ant, Apache Maven and sbt based projects as well as arbitrary shell scripts and Windows batch commands. The creator of Jenkins is Kohsuke Kawaguchi. Released under the MIT License, Jenkins is free software.

Builds can be triggered by various means, for example by commit in a version control system, by scheduling via a cron-like mechanism and by requesting a specific build URL. It can also be triggered after the other builds in the queue have completed. Jenkins functionality can be extended with plugins.

The Jenkins project was originally named Hudson, and was renamed after a dispute with Oracle, which had forked the project and claimed rights to the project name. The Oracle fork, Hudson, continued to be developed for a time before being donated to the Eclipse Foundation. Oracle's Hudson is no longer maintained and was announced as obsolete in February 2017.
-Wiki

Krishantha Dinesh

October 21, 2019
Tweet

More Decks by Krishantha Dinesh

Other Decks in Programming

Transcript

  1. Introduction to Jenkins Krishantha Dinesh Msc, MIEEE, MBCS Software Architect

    www.krishantha.com www.youtube.com/krish @krishantha
  2. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Continues intergration • In

    Continuous Integration, the software is built and tested immediately followed by commit. With each commit code is built and tested. If the test is passed, build is tested for deployment. If deployment is a success, the code is pushed to production. This commit, build, test, and deploy is a continuous process and hence the name continuous integration/deployment.
  3. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Following tools play major

    role on continues integration. • Continuous Integration Server (Jenkins, Bamboo, etc) • Source Control Tool (GIT, CVS, SVN, Mercurial, Perforce, ClearCase etc) • Build tool (Make, ANT, Maven, Ivy, Gradle etc) • Automation testing framework (Selenium, Appium, TestComplete, UFT etc)
  4. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ What is Jenkins •

    Jenkins is an open source Continuous Integration server capable of orchestrating a chain of actions in CI process • Jenkins is entirely written in Java and it is a widely used application around the world that has around 300k installations and growing day by day. • It is a server-based application and requires a web server like Apache Tomcat. • The reason Jenkins became so popular is that of its monitoring of repeated tasks which arise during the development of a project. • By using Jenkins, software companies can accelerate their software development process, as Jenkins can automate build and test at a rapid rate. • Jenkins supports the complete development lifecycle of software from building, testing, documenting the software, deploying and other stages of a software development lifecycle.
  5. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ History • Kohsuke Kawaguchi

    was tired of building the code and fixing errors repetitively. In 2004, created an automation server called Hudson that automates build and test task. • In 2011, Oracle who owned Sun Microsystems had a dispute with Hudson open source community, so the forked Hudson and renamed it as Jenkins. • Both Hudson and Jenkins continued to operate independently. But in short span of time, Jenkins acquired a lot of projects and contributors while Hudson remained with only 32 projects. With time, Jenkins became more popular, and Hudson is not maintained anymore.
  6. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Install Jenkins • Download

    Jenkins from https://jenkins.io/download/ • You can download distribution which matches to your operating system OR generic war file. Inorder to run war file you need java installed • You can run downloaded Jenkins as follows.
  7. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Run jenkins • After

    execute it will show default admin password in log. Copy that and run http://localhost:8080 • Paste copied password on initial page
  8. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Run as docker •

    docker run -p 8080:8080 -p 50000:50000 --name jenkins -d jenkins/jenkins:lts Or • docker run -p 8080:8080 -p 50000:50000 --name jenkins -d -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts To unlock log in to docker • docker exec -it jenkins bash Now can get the password cat /var/jenkins_home/secrets/initialAdminPassword
  9. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ security • Go to

    Manage Jenkins -> configure global security to configure authentication and authorizations
  10. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Anonymous read • Once

    you enable anonymous read only access public users can come and check status without login
  11. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Create build • We

    need sample project. You can have your own one or clone this https://github.com/krish/microservice-samples.git You need maven to run above example. So download maven if you do not have • Navigate to project folder • Manually test and package to make sure everything inline. • mvn test • mvn package
  12. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Configure directory settings Either

    you need to have install maven locally OR if you use docker you need let Jenkins to install maven online. Either case you need to configure maven from global tool configuration and set that version here when you configure job.
  13. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ workspace • You can

    click on workspace and check what is happening inside Jenkins during build process
  14. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Archive • We may

    need to archive previous build before move in to next one. We can do this with post build steps Project view before and after configure archive
  15. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Plugins • Plugins is

    the way any system use to give additional functionality • Jenkins also has various plugins to help to do what are the task you want to perform.