15. Building the Project

This section covers how to build the project. It covers:

15.1 Project Setup

The following diagram shows the folder structure of Spring Cloud Pipelines:

├── common
├── concourse
├── dist
├── docs
├── docs-sources
└── jenkins

In the common folder, you can find all the Bash scripts that contain the pipeline logic. These scripts are reused by both the Concourse and Jenkins pipelines.

In the concourse folder, you can find all the necessary scripts and setup information to run the Concourse demo.

In the dist folder, you can find the packaged sources of the project. Since the package contains no tests or documentation, it is extremely small and can be used in the pipelines.

In the docs folder, you can find the whole generated documentation of the project.

In the docs-source folder, you can find the sources required to generate the documentation.

In the jenkins folder, you can find all the necessary scripts and setup information to run the Jenkins demo.

15.2 Prerequisites

As prerequisites, you need to have shellcheck, bats, jq and ruby installed. If you use a Linux machine, bats and shellcheck are installed for you.

To install the required software on Linux, type the following command:

$ sudo apt-get install -y ruby jq

If you use a Mac, run the following commands to install the missing software:

$ brew install jq
$ brew install ruby
$ brew install bats
$ brew install shellcheck

15.3 Bats Submodules

To make bats work properly, we needed to attach Git submodules. To have them initialized, either clone the project or (if you have already cloned the project) pull to update it. The following command clones the project:

$ git clone --recursive https://github.com/spring-cloud/spring-cloud-pipelines.git

The following commands pull the project:

$ git submodule init
$ git submodule update

If you forget about this step, Gradle runs these steps for you.

15.4 Build and test

Once you have installed all the prerequisites, you can run the following command to build and test the project:

$ ./gradlew clean build

15.5 Generate Documentation

To generate the documentation, run the following command:

$ ./gradlew generateDocs

15.6 Distributions

Spring Cloud Pipelines has a lot of tests, including Git repositories. Those and the documentation “weigh” a lot. That is why, under the dist folder, we publish zip and tar.gz distributions of the sources without tests and documentation. Whenever we release a distribution, we attach a VERSION file to it that contains build and SCM information (build time, revision number, and other details). To skip the distribution generation pass the skipDist property on the command line, as follows:

$ ./gradlew build -PskipDist

15.7 Making a Release

You can run the release task to automatically test the project, build the distributions, change the versions, build the docs, upload the docs to Spring Cloud Static, tag the repo, and then revert the changed versions back to default. To do so, run the following command:

$ ./gradlew release -PnewVersion=1.0.0.RELEASE