Continuous Integration and Continous Delivery

Fabric8 DevOps provides a Continuous Integration and Continous Delivery (CI and CD) infrastructure built as a set of Kubernetes resources which are easy to Install.

Continous Delivery Diagram

Overview

Continuous Integration and Continous Delivery in Fabric8 DevOps consists of the following open source components:

  • Jenkins for Building, Continuous Integration and creating Continuous Delivery pipelines.
  • Nexus as the artifact repository for caching public artifacts and hosting canary and real release artifacts
  • Gogs for on premise git repository hosting and GitHub for public hosting
  • SonarQube provides a platform to maintain code quality
  • Chat to support social integration between your teams and the infrastructure

In addition it adds the following optional capabilities:

You can choose to opt in or out of any of the micro services within Fabric8 DevOps; for example use any git repository hosting or Nexus installation. The Chat integration works with hubot so that it can work with any back end chat service such as IRC, Slack, HipChat, Campfire etc.

By default we try and integrate all the components closely out of the box so Fabric8 DevOps is an easy, 1 click install. e.g. by default Jenkins builds will use the local Nexus server for all downloads of maven artifacts and for all canary and full releases.

Since Fabric8 DevOps is built on top of Kubernetes we get an easy way to scale (e.g. Jenkins build slaves) together with letting us reuse Kubernetes services for service discovery to wire up the various components (e.g. for Jenkins to discover Nexus). If you opt out of any of the default implementations; you just need to create a Kubernetes Service pointing to your external installation of the service.

Automate Jenkins Jobs

Teams often have many git repositories with many artifacts and docker container builds. Manually maintaining individual Jenkins build configurations for each git repository can be time consuming and error prone.

So we recommend the use of the Jenkins Job DSL to generate the Jenkins build jobs for your projects.

The Jenkins app comes with a template parameter SEED_GIT_URL which is the location of the git repository to clone in Jenkins for the Jenkins Job DSL used to generate the Jenkins builds. Any change in that git repository results in the seed job being rerun which then regenerates any of its Jenkins jobs.

The SEED_GIT_URL parameter defaults to the value https://github.com/fabric8io/default-jenkins-dsl.git for the default-jenkins-dsl project which provides an example set of scripts to iterate over your projects and create the necessary jobs for them. We hope soon those scripts will automatically setup CI / CD jobs for projects in the hosted Gogs repositories (for now it will iterate over a github organisation and generates builds for matching projects).

Installation

If you have Apache Maven installed then the following instructions should get you going.

    export KUBERNETES_DOMAIN=vagrant.f8
  • if you have run the Fabric8 Continuous Deployment before its a good idea to get the latest console and jenkins images. If this is the first time you are running it you can skip this step (though it does no harm):
    docker pull fabric8/fabric8-console
    docker pull fabric8/jenkins
  • type the following commands
    git clone https://github.com/fabric8io/fabric8-installer.git
    cd fabric8-installer
    cd cdelivery
    mvn install

If you are running the Fabric8 vagrant image and have setup your local machine's /etc/hosts file then you should be able to open http://gogs.vagrant.f8/ then click the sign in up link.

For now use user gogsadmin and password RedHat$1 as the user and password in gogs (unless you changed the defaults).

  • Now in the fabric8 console if you click the Projects tab the Repositories sub tab should be available. This prompts you to login to gogs with the user and password (until we can get single sign on working with gogs and OpenShift)

  • Once you are logged in the Repositories tab should show a Create Project button on the top right. Click that and try create a project. On the second page of the wizard you get to choose which archetype to use as the start of the project. (If this combo box doesn't populate first time, its a little bug, go back in your browser and try again ;).

  • A good start project is the camel-cdi archetype but try any of the archetypes you like the look of.

  • Once you click the Execute button the new git repository should be created, the initial code for the project generated from the archetype using the group and artifact IDs and Java package names you picked.

  • You should now be able to see the new repository in the Repositories page and browse the repository in gogs via the Browse button and open the editor using the Edit button.

  • The create project wizard should also now have triggered the Jenkins Job DSL to generate the CI / CD builds for this new project by triggering the seed build in Jenkins. If you look at the jenkins install - by default at http://jenkins.vagrant.f8 you should see either the seed build running or the new builds created for your project!

  • Now you might want to setup Chat so that you see chat room notifications of builds and kubernetes resources change.

For more information see Install Fabric8 on OpenShift Guide.

Demo

Here is a video demonstrating Fabric8 Continuous Delivery Pipelines