7. Concourse Pipeline (Cloud Foundry)


In this chapter, we assume that you deploy your application to Cloud Foundry PaaS.

The Spring Cloud Pipelines repository contains opinionated Concourse pipeline definitions. Those jobs form an empty pipeline and an opinionated sample pipeline one that you can use in your company.

There following projects take part in the microservice setup for this demo.

7.1 Step-by-step

If you want only to run the demo as far as possible by using PCF Dev and Docker Compose, do the following:

7.1.1 Fork Repositories

Four applications compose the pipeline

You need to fork only the following repositories, because only then can you tag and push the tag to the repository:

7.1.2 Start Concourse and Artifactory

You can run Concourse + Artifactory locally. To do so, run the start.sh script from this repository. The following listing shows the script:

git clone https://github.com/spring-cloud/spring-cloud-pipelines
cd spring-cloud-pipelines/concourse

The setup_docker_compose.sh script should be run only once, to allow generation of keys.

The param is an example of an external URL of Concourse (equal to the Docker-Machine IP in this example).

Then Concourse runs on port 8080, and Artifactory runs on 8081.

Deploy the infra JARs to Artifactory

When Artifactory is running, run the tools/deploy-infra.sh script from this repo. The following listing shows the script:

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

As a result, both eureka and stub runner repos are cloned, built, and uploaded to Artifactory.

7.1.3 Start PCF Dev


You can skip this step if you have CF installed and do not want to use PCF Dev. The only thing you have to do is to set up spaces.


Servers often run run out of resources at the stage step. If that happens, clear some apps from PCF Dev and continue.

You have to download and start PCF Dev, as described here.

The default credentials for PCF Dev are as follows:

username: user
password: pass
email: user
org: pcfdev-org
space: pcfdev-space
api: api.local.pcfdev.io

You can start the PCF Dev as follows:

cf dev start

You must create three separate spaces, as follows:

cf login -a https://api.local.pcfdev.io --skip-ssl-validation -u admin -p admin -o pcfdev-org

cf create-space pcfdev-test
cf set-space-role user pcfdev-org pcfdev-test SpaceDeveloper
cf create-space pcfdev-stage
cf set-space-role user pcfdev-org pcfdev-stage SpaceDeveloper
cf create-space pcfdev-prod
cf set-space-role user pcfdev-org pcfdev-prod SpaceDeveloper

You can also run the ./tools/cf-helper.sh setup-spaces script to create the spaces.

7.1.4 Setup the fly CLI

If you go to the Concourse website, you should see something resembling the following image:

running concourse

You can click one of the icons (depending on your OS) to download fly, which is the Concourse CLI. Once you download that (and maybe, depending on your OS, add it to your PATH) you can run the following command:

fly --version

If fly is properly installed, it should print out the version.

7.1.5 Set up Your credentials.yml File

The repository comes with credentials-sample-cf.yml, which is set up with sample data (mostly credentials) that are applicable for PCF Dev. Copy this file to a new file called credentials.yml (the file is added to .gitignore so that you cannot push it with your passwords) and edit it as you wish. For our demo, set up the following:

  • app-url: URL pointing to your forked github-webhook repository.
  • github-private-key: Your private key to clone and tag GitHub repositorys.
  • repo-with-binaries: The IP is set to the defaults for Docker Machine. You should update it to point to your setup.

If you do not have a Docker Machine, run th ./whats_my_ip.sh script to get an external IP that you can pass to your repo-with-binaries, instead of the default Docker Machine IP.

The following table describes the environment variables required by the scripts:

Property NameProperty DescriptionDefault value


Additional options you would like to pass to the Maven / Gradle build



The URL to the CF Api for TEST env



The URL to the CF Api for STAGE env



The URL to the CF Api for PROD env



Name of the org for the test env



Prefix of the name of the CF space for the test env to which the app name will be appended



Name of the org for the stage env



Name of the space for the stage env



Name of the org for the prod env



Name of the space for the prod env



URL to repo with the deployed jars


The id of server from Maven settings.xml



Additional suffix for the route. In a shared environment the default routes can be already taken


The right column shows the default values for PCF Dev that we set in the credentials-sample-cf.yml. PAAS_HOSTNAME_UUID and BUILD_OPTIONS have no default values.

7.1.6 Build the Pipeline

Log in (for example, for a Concourse instance running at — if you do not provide any value, localhost is assumed). If you run the login script, it assumes that either fly is on your PATH or it is in the same folder as the script. The following example shows how to specify an IP address for the login script:


Next, run the command to create the pipeline, as follows:


Then you can create a github-webhook pipeline under the docker alias, using the provided credentials.yml file. You can override these values in exactly that order (for example ./set-pipeline.sh some-project another-target some-other-credentials.yml)

7.1.7 Run the github-webhook Pipeline

The following images show the various steps involved in running the github-webhook pipeline:


Figure 7.1. Click Login

concourse login


Figure 7.2. Pick main team

concourse team main


Figure 7.3. Log in with concourse user and changeme password

concourse user pass


Figure 7.4. Your screen should look more or less like this

concourse pipeline


Figure 7.5. Unpause the pipeline by clicking in the top lefr corner and then clicking the play button

start pipeline


Figure 7.6. Click 'generate-version'

generate version


Figure 7.7. Click + sign to start a new build

run pipeline


Figure 7.8. The job is pending

concourse pending


Figure 7.9. Job is pending in the main screen

job running


Figure 7.10. Job is running in the main screen

running pipeline