Spring Cloud Pipelines

1.0.0 M8

Spring, Spring Boot and Spring Cloud are tools that allow developers speed up the time of creating new business features. It’s common knowledge however that the feature is only valuable if it’s in production. That’s why companies spend a lot of time and resources on building their own deployment pipelines.

This project tries to solve the following problems:

  • Creation of a common deployment pipeline

  • Propagation of good testing & deployment practices

  • Speed up the time required to deploy a feature to production

A common way of running, configuring and deploying applications lowers support costs and time needed by new developers to blend in when they change projects.

Currently, we support the following CI / CD systems out of the box

  • Concourse

  • Jenkins

Features

Spring Cloud Pipelines comes with the following features

  • opinionated microservice pipeline for Concourse

  • opinionated microservice pipeline for Jenkins using Job DSL plugin

  • opinionated microservice pipeline for Jenkins using the Declarative Pipeline (Jenkinsfile)

  • Cloud Foundry PaaS support

  • Kubernetes PaaS support

The opinionated pipelines look like this:

Flow in Concourse

flow concourse
Figure 1. Flow in Concourse

Flow in Jenkins

flow
Figure 2. Flow in Jenkins

Spring Boot Config

Running the demo for Cloud Foundry

You can easily start by running the default demo setup to run the whole system locally using Docker / PCF Dev or Minikube.

We are providing a demo pipeline that will build and deploy - Github Webhook application.

All in all there are the following projects taking part in the whole microservice setup.

  • Github Analytics - the app that has a REST endpoint and uses messaging. Our business application.

  • Github Webhook - project that emits messages that are used by Github Analytics. Our business application.

  • Eureka - simple Eureka Server. This is an infrastructure application.

  • Github Analytics Stub Runner Boot - Stub Runner Boot server to be used for tests with Github Analytics. Uses Eureka and Messaging. This is an infrastructure application.

For the detailed information please check out the docs.

Concourse

  • Fork the Github Webhook and https://github.com/spring-cloud-samples/github-analytics [Github Analytics] repository

  • Start PCF Dev

  • Clone the spring-cloud-pipelines project

  • Go to concourse folder

  • Run ./setup-docker-compose.sh to setup keys for Concourse

  • Run ./start.sh 192.168.99.100 to start Concourse and Artifactory (e.g. for 192.168.99.100 being external IP of your docker images. If you don’t have Docker Machine you can run the ./what_my_ip.sh script and pass that value here)

  • Run ./deploy_infra.sh to upload to your Artifactory the infrastructure apps (eureka and stub runner)

  • Run ./login.sh 192.168.99.100 to log in to your Concourse (where 192.168.99.100 is you Docker Machine ip - if you’re using localhost you don’t have to provide that value)

  • Setup your credentials.yml basing on the provided credentials-sample-cf.yml (point to your forked [Github Webhook](https://github.com/spring-cloud-samples/github-webhook))

  • Run ./set-pipeline.sh to setup pipeline for github-webhook

  • Unpause and run the pipeline in Concourse!

  • Once the pipeline passes you can setup a new pipeline for github-analytics

For the Kubernetes step by step guide just check out the documentation.

Jenkins

  • Fork the Github Webhook and Github Analytics repository

  • Start PCF Dev

  • Clone the spring-cloud-pipelines project

  • Go to jenkins folder

  • Run ./start.sh yourGithubUser yourGithubPass yourGithubOrg to start Jenkins and Artifactory (yourGithubUser and yourGithubPass are your Github credentials required by the pipeline to tag the forked repo that lays in yourGithubOrg; you could also pass -key path_to_private_key if you prefer to use the key-based authentication with your Git repositories)

  • Run ./deploy_infra.sh to upload to your Artifactory the infrastructure apps (eureka and stub runner)

  • Go to Jenkins and click the jenkins-pipeline-seed in order to generate the pipeline jobs

  • Go to the github-webhook pipeline view and click the play button to run the pipeline

For the Kubernetes step by step guide just check out the documentation

Adjusting the pipelines to your needs

This repository can be treated as a template for your pipeline. We provide some opinionated implementation that you can alter to suit your needs. The best approach to use it to build your production projects would be to download the Spring Cloud Pipelines repository as ZIP, then init a Git project there and modify it as you wish.

Example for using the code from master branch. You can use a tag for example 1.0.0.M8. Then your URL will look like this https://github.com/spring-cloud/spring-cloud-pipelines/archive/1.0.0.M8.zip .

$ curl -LOk https://github.com/spring-cloud/spring-cloud-pipelines/archive/master.zip
$ unzip master.zip
$ cd spring-cloud-pipelines-master
$ git init
$ ./gradlew customize
$ # modify the pipelines to suit your needs
$ git add .
$ git commit -m "Initial commit"
$ git remote add origin ${YOUR_REPOSITORY_URL}
$ git push origin master

You can also clone the repository in case you would like to keep aligned with the changes in the upstream repository. In order not to have many merge conflicts it’s encouraged to use the custom folder hooks to override functions.

Quick start

Bootstrap your application with Spring Initializr.

Documentation

Each Spring project has its own; it explains in great details how you can use project features and what you can achieve with them.
1.0.0 M8 PRE CURRENT Reference Doc. API Doc.
1.0.0 SNAPSHOT Reference Doc. API Doc.