Java Continuous Integration and Delivery Infrastructure

Overview

Below is a list of items used for implementing the continuous integration and delivery infrastructure for Java projects.

Active Directory User

This is needed for Maven and Jenkins to get through the proxy server.  

  • Maven needs to pull 3rd party dependencies from Maven Central.
  • Jenkins needs to pull from the central plugin sites.

Linux User

This user is needed to pull the source code from Git, as Jenkins.  

Create a Git Source Code Repository

cd /home/continuous/git/
git init --shared --bare project-name
            

Tomcat Server

  • Run in headless mode:
    export CATALINA_OPTS=-Djava.awt.headless=true
    
    /opt/tomcat/apache-tomcat-8.0.50/bin/shutdown.sh
    /opt/tomcat/apache-tomcat-8.0.50/bin/startup.sh
                        
    Alternatively, create a start script at the following location that has export for headless mode.
    /opt/tomcat/apache-tomcat-8.0.50/start.sh
                        

    The alternative start script is only needed if you are seeing the following error:

    java.awt.AWTError: Can't connect to X11 window server                        
                        

  • Install Tomcat 8.0 as a service.
  • This server is used to host the following:
    • Jenkins
    • developer documentation
    • any other Web apps used by the project
  • Configure the proxy server for Jenkins.

              
  • /home/rmarquez $ cp workspace/jenkins.war /opt/tomcat/apache-tomcat-8.0.50/webapps/continuous.war

Maven Proxy Server Configuration

Install the settings.xml file on the Linux box under the tomcat user's ~/.m2/ directory. 

Be sure to update the password in the example settings.xml file.

Jenkins

Continuous Instance

Jenkins WAR Download

  • $ cp workspace/jenkins.war /opt/tomcat/apache-tomcat-8.0.50/webapps/continuous.war

As a last resort, have Jenkins skip the SSL certificate if configuring secure connections is not configurable on the network.  

Allow the Javadoc frames to populate by running the following in the Jenkins Script console:

    System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "default-src 'none'; img-src 'self'; style-src 'self'; child-src 'self'; frame-src 'self'; script-src 'unsafe-inline';");                
            

Git Credentials Configuration (for use with ssh protocol)

  • On the host with the git Repositories, execute the following as the Unix user used for accessing the Git repositories.
    $ ssh-keygen
                            
  • Scope: Global
    user: unix-username
    Private Key: From a file on Jenkins master
        
                    /home/flastquez/.ssh/id_rsa.pub
    
    Description: Git with ssh protocol
                            

Access Control List

  • Active Directory plugin
    • https://updates.jenkins.io/download/plugins/active-directory/
    • https://plugins.jenkins.io/active-directory
  • Configure Global Security
    • Security Realm -> Active Directory

Source Code Repository Browser

The source code repository browser provides an easy way to

  • view a file's history
  • view diffs between versions of the file

Current front runner: https://github.com/klaussilveira/gitlist

Gitblit

  • Gitblit Instance
  • https://github.com/klaussilveira/gitlist
  • Download the WAR version and deploy it to Tomcat
  • Edit the configuration file

    /opt/tomcat/apache-tomcat-8.0.50/webapps/gitblit-1.8.0/WEB-INF/data/gitblit.properties

    to contian the location of Git repositories.

    git.repositoriesFolder = /home/continuous/git

Source Code Static Analysis Tool

SonarQube





back    |    top