In part three of my continuous integration project I'll be completing the Jenkins setup. I will show how to create a new job, install plugins, and setup credentials to connect to the Git repository we created in Part 2.
Lets return to the Jenkins server. We previously installed the Java run time environment but we didn't install the JDK development environment. You can skip this step if your project is not a Java project.
Step 1) Install the JDK we forgot when creating the Jenkins server> yum list available | grep java-1.7
java-1.7.0-openjdk.x86_64 1:22.214.171.124-126.96.36.199.el6_6 updates
java-1.7.0-openjdk-demo.x86_64 1:188.8.131.52-184.108.40.206.el6_6 updates
java-1.7.0-openjdk-devel.x86_64 1:220.127.116.11-18.104.22.168.el6_6 updates
java-1.7.0-openjdk-javadoc.noarch 1:22.214.171.124-126.96.36.199.el6_6 updates
java-1.7.0-openjdk-src.x86_64 1:188.8.131.52-184.108.40.206.el6_6 updates
> yum install git
Step 3) Create the SSH key pair for the Jenkins user.
The yum install of Jenkins sets the Jenkins user shell to /bin/false, thus is unable to su directly to the jenkins user. Running the following command will generated the ssh key pair for the Jenkins user.
> sudo -u jenkins ssh-keygen
Add the Git repository server to the knows_hosts file for the Jenkins user, answer yes to the question.
> sudo -u jenkins ssh firstname.lastname@example.org
The authenticity of host '10.52.188.97 (10.52.188.97)' can't be established.
RSA key fingerprint is 7c:e6:3d:18:c1:0a:6e:f6:1d:7c:96:f4:f5:c3:da:a5.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.52.188.97' (RSA) to the list of known hosts.
Last login: Thu Dec 18 13:57:18 2014 from 220.127.116.11
Step 4) Add some plugins to Jenkins
First lets navigate to our Jenkins instance, then select;
manage Jenkins --> --> Manage Plugins --> Available Tab
- Git Plugin
- Git Client Plugin
- Git Parameter Plugin
- git-notes Plugin
- git tag message Plugin
- Green Balls "Changes Hudson/Jenkins to use green balls instead of blue for successful builds
Select Global Credentials
STEP 6) Jenkins Configure System
Return to Jenkins HOME then Select Manage Jenkins --> Configure System.
a) Scroll down and add a JDK installation.
Give it a name, then set the JAVA_HOME location (/usr/lib/jvm/java1.7.0-openjdk.x86_64)
b) Add a Maven installation.
c) Add a Git Installation
Step 7) Create a Jenkins job
Since every project will be different I will leave it up to you to configure your Jenkins job to compile and package your app. I will be revisiting this in a future post when I create the Docker Image.