2016-09-19 Quick Jenkins install
Well I must have over a hundred tips I wrote up on sysadmin and development tasks over the past few years I still need to catch up on putting into this blog.
This is a quick example of installing and enabling Jenkins on Ubuntu. Jenkins is a continuous integration system. Basically it provides a web interface that shows the jobs and their results and the same interface is used to configure it, extend it, automate or manually control jobs. It is commonly used to build and test software on other systems and show the results in a single place. I have been using it for over four years. (Prior to that, I did research it, but wrote my own lightweight and portable testing framework that had at one time or another over 40 systems attached to it.)
While jenkins components were in my "apt-cache search jenkins" list I didn't see any main or meta package and all docs I found said to get from upstream:
$ wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add - $ echo deb http://pkg.jenkins.io/debian-stable binary/ | sudo tee -a /etc/apt/sources.list.d/jenkins.list $ sudo apt-get update $ sudo apt-get install jenkins
The above also enabled and started the jenkins service. It is a java-based software. By default, its webserver listens on port 8080. So visit it. At first start, it needs a password. Mine was at /var/lib/jenkins/secrets/initialAdminPassword . It was running Jenkins 2.7.4.
Then choose suggested plugins or choose own. I chose my own. I selected "SSH plugin". It has others already checked so I left those suggestions as-is. Then it showed the "Getting started" progress bar and showed the plugins getting installed and their required dependencies.
Next create first admin user, and click the "save and finish" button. Then click "start using jenkins" button when it says setup is complete.
Welcome to Jenkins.
The main interface has a "Please create new jobs to get started." link. Follow it. Enter item name. For a quick test, I entered "ps". Then choose type. I chose Freestyle project. Then can click OK. Then it allows further details and options for it, like parameterized, discard old builds, use git, setup build triggers like periodic or SCM polling, etc.
Under the "Build: Add built step" section, I selected execute shell script on remote hosting using ssh. For the action I entered "ps auxwww". Note the ssh site is empty dropdown and cannot type into it. So save and then at main jenkins go to Configure System (/configure link). And then for SSH remote hosts click the Add button for SSH sites (that projects will want to connect). Be sure to add port number (22). I created a testing account for this (useradd -m ...; sudo passwd ...).
Back at my new project configure page it now shows the user@host:port entry for the SSH site. I clicked save. Note that the common Jenkins use is to have a java-based Jenkins server running on each remote system. The SSH way is a lightweight way instead.
I clicked Build now and it said job scheduled and a moment later I had a build history #1. Clicked it and then "Console output" and saw the ps output.
Jenkins has a lot of plugins and features for integrating with many build and test systems with properly showing results and understanding output such as identifying changes between runs.