===== Jenkins Continuous Improvement ===== "In a nutshell, Jenkins is the leading open source automation server. Built with Java, it provides hundreds of plugins to support building, testing, deploying and automation for virtually any project." -- From the Jenkins CI web site. === Install Jenkins === On ''master'', install the Jenkins CI master service: wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - sudo sh -ec '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 === Configure Jenkins === Once installed, Jenkins defaults to allow anyone who visits the page to create and run jobs; this is probably not how you want to run in production so we'll fix that with a little configuration. On ''client'': - Visit [[http://master/jenkins/|http://master/jenkins/]] - Click //Manage Jenkins// -> //Configure Global Security// - Click Enable Security - Under //Access Control// choose //Jenkins' own user database// and un-check //Allow users to sign up// - Under //Authorization// choose //Project-based Matrix Authorization Strategy// - Add our //waytta// user and check all the boxes then //Save// - You'll immediately be redirected to a page to set a password, email address and name - Login using //waytta// and our default password === Create a Job === Our first job is simple, run the ''/usr/bin/w'' command on //master//. On ''client'': - Visit [[http://master/jenkins/|http://master/jenkins/]] - Click the //create new jobs// link - In //Item name// type ''Run w'' as a descriptive title - Choose //Freestyle project// and click ''OK'' - On the next page fill in //Description// with ''Run the Unix w command'' - Check //Discard Old Builds// - Under //Build// choose ''Execute shell'' - Type the letter ''w'' in the //Command// box or fully specify ''/usr/bin/w'' - Click //Save// Congratulations! You just created your first Jenkins job. === Run Job === Now that we have a job, run it. On ''client'': - Visit [[http://master/jenkins/|http://master/jenkins/]] - Click ''Run w'' in the //Name// column - Click ''Build Now'' in the menu on the left You may see a //Build scheduled// notification then a blue dot with a //#1// should appear in the //Build History// pane. Congratulations! You just ran your first Jenkins job. === Confirm Job === So, how do you know anything actually happened? What does the little blue dot mean? - Click the ''#1'' link under //Build History// to see the build status for that run - Click //Console Output// (terminal icon) in the left menu This is the //Console Output// of the //Run w// job which runs the ''/usr/bin/w'' Unix command: Started by user Curry Searle Building in workspace /var/lib/jenkins/jobs/Run w/workspace [workspace] $ /bin/sh -xe /tmp/hudson2725330295819146079.sh + w 19:48:05 up 9:17, 1 user, load average: 0.01, 0.04, 0.05 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT waytta pts/0 192.168.1.138 10:33 12:04 3.26s 3.26s -bash Finished: SUCCESS Congratulations! You completed this lesson. === Resources === * [[http://pkg.jenkins-ci.org/debian/|Jenkins Repo]] - Jenkins Debian/Ubuntu Repository