#764 - Introduce Concourse CI.

Introduces pipeline that replaces the Bambook Spring HATEOAS one which builds on master branch and deploys to artifactory.

Additionally:

* Tests against JDK 8, 11, and 12 before doing the final build and deploy.
* Also handles pull requests, running same suite of tests against mutiple JDKs.
This commit is contained in:
Greg Turnquist
2018-12-12 13:36:52 -06:00
parent 1731b49bc6
commit 7874be5b08
9 changed files with 526 additions and 53 deletions

3
.gitignore vendored
View File

@@ -5,4 +5,5 @@ target/
*.iml
.idea
*.orig
.springBeans
.springBeans
credentials.yml

View File

@@ -1,18 +0,0 @@
language: java
jdk:
- oraclejdk8
env:
matrix:
- PROFILE=non-existant
- PROFILE=spring5-next
- PROFILE=spring51-next
addons:
apt:
packages:
- oracle-java8-installer
cache:
directories:
- $HOME/.m2
sudo: false
install: true
script: "./mvnw clean dependency:list test -P${PROFILE} -Dsort"

38
ci/README.adoc Normal file
View File

@@ -0,0 +1,38 @@
== Spring HATEOAS CI
Spring HATEOAS uses Concourse as it's CI tool of choice. This provides support for:
* Pipeline against the `master` branch
* Support for pull requests
=== Creating a pipeline
Using the `fly` command, you can execute a series of commands to create multiple pipelines to manage everything. But
first, some critical credentials are needed.
Create a `credentials.yml` file like this:
[source,yml]
----
github-access-token: <your Personal Access Token from github>
docker-email: <your docker hub email address>
docker-username: <your docker hub username>
docker-password: <your docker hub password>
artifactory-username: <your artifactory username>
artifactory-password: <your artifactory encoded password>
----
WARNING: Do NOT check this file into source control! If you'll check, `credentials.yml` is listed in `.gitignore` to prevent this.
With this in place, run the following `fly` commands to create pipelines:
----
% fly -t spring-data sp -p spring-hateoas -c ci/pipeline-template.yml -l credentials.yml -v branch=master
----
With this pipeline in place, you can now activate and expose it:
----
% fly -t spring-data unpause-pipeline -p spring-hateoas
% fly -t spring-data expose-pipeline -p spring-hateoas
----

14
ci/build.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
set -euo pipefail
[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2
spring_hateoas_artifactory=$(pwd)/spring-hateoas-artifactory
rm -rf $HOME/.m2/repository/org/springframework/hateoas 2> /dev/null || :
cd spring-hateoas-github
./mvnw -Pdistribute -Dmaven.test.skip=true clean deploy \
-DaltDeploymentRepository=distribution::default::file://${spring_hateoas_artifactory}

20
ci/build.yml Normal file
View File

@@ -0,0 +1,20 @@
---
platform: linux
image_resource:
type: docker-image
source:
repository: openjdk
tag: 8-jdk
inputs:
- name: spring-hateoas-github
outputs:
- name: spring-hateoas-artifactory
caches:
- path: maven
run:
path: spring-hateoas-github/ci/build.sh

368
ci/pipeline-template.yml Normal file
View File

@@ -0,0 +1,368 @@
---
resource_types:
- name: artifactory-resource
type: docker-image
source:
repository: springio/artifactory-resource
tag: 0.0.6
- name: github-status
type: docker-image
source:
repository: dpb587/github-status-resource
tag: master
- name: pull-request
type: docker-image
source:
repository: jtarchie/pr
tag: latest
- name: slack-notification
type: docker-image
source:
repository: nebhale/slack-notification-resource
resources:
- name: openjdk:8-jdk
type: docker-image
source:
repository: openjdk
tag: 8-jdk
- name: openjdk:11-jdk
type: docker-image
source:
repository: openjdk
tag: 11-jdk
- name: openjdk:12-jdk
type: docker-image
source:
repository: openjdk
tag: 12-jdk
- name: spring-hateoas-github
type: git
source:
uri: https://github.com/spring-projects/spring-hateoas.git
branch: ((branch))
- name: spring-hateoas-artifactory
type: artifactory-resource
source:
uri: https://repo.spring.io
username: ((artifactory-username))
password: ((artifactory-password))
build_name: spring-hateoas
- name: spring-hateoas-pull-requests
type: pull-request
source:
access_token: ((github-access-token))
repo: spring-projects/spring-hateoas
base: ((branch))
- name: spring-hateoas-status
type: github-status
source:
access_token: ((github-access-token))
repository: spring-projects/spring-hateoas
branch: ((branch))
- name: slack
type: slack-notification
source:
url: ((slack))
groups:
- name: spring-hateoas
jobs:
- Test - JDK 8
- Test - JDK 8 and Spring 5.0 (snapshots)
- Test - JDK 8 and Spring 5.1 (snapshots)
- Test - JDK 11
- Test - JDK 11 and Spring 5.0 (snapshots)
- Test - JDK 11 and Spring 5.1 (snapshots)
- Test - JDK 12
- Test - JDK 12 and Spring 5.0 (snapshots)
- Test - JDK 12 and Spring 5.1 (snapshots)
- Build
- name: pull-requests
jobs:
- spring-hateoas-pull-requests
jobs:
- name: Test - JDK 8
serial: true
public: true
plan:
- get: spring-hateoas-github
trigger: true
- get: openjdk:8-jdk
trigger: true
- task: test
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "non-existent" }
<<: *slack-failure
- name: Test - JDK 8 and Spring 5.0 (snapshots)
serial: true
public: true
plan:
- get: spring-hateoas-github
trigger: true
- get: openjdk:8-jdk
trigger: true
- task: test
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "spring5-next" }
<<: *slack-failure
- name: Test - JDK 8 and Spring 5.1 (snapshots)
serial: true
public: true
plan:
- get: spring-hateoas-github
trigger: true
- get: openjdk:8-jdk
trigger: true
- task: test
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "spring51-next" }
<<: *slack-failure
- name: Test - JDK 11
serial: true
public: true
plan:
- get: spring-hateoas-github
trigger: true
- get: openjdk:11-jdk
trigger: true
- task: test
image: openjdk:11-jdk
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "non-existant" }
<<: *slack-failure
- name: Test - JDK 11 and Spring 5.0 (snapshots)
serial: true
public: true
plan:
- get: spring-hateoas-github
trigger: true
- get: openjdk:11-jdk
trigger: true
- task: test
image: openjdk:11-jdk
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "spring5-next" }
<<: *slack-failure
- name: Test - JDK 11 and Spring 5.1 (snapshots)
serial: true
public: true
plan:
- get: spring-hateoas-github
trigger: true
- get: openjdk:11-jdk
trigger: true
- task: test
image: openjdk:11-jdk
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "spring51-next" }
<<: *slack-failure
- name: Test - JDK 12
serial: true
public: true
plan:
- get: spring-hateoas-github
trigger: true
- get: openjdk:12-jdk
trigger: true
- task: test
image: openjdk:12-jdk
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "non-existant" }
<<: *slack-failure
- name: Test - JDK 12 and Spring 5.0 (snapshots)
serial: true
public: true
plan:
- get: spring-hateoas-github
trigger: true
- get: openjdk:12-jdk
trigger: true
- task: test
image: openjdk:12-jdk
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "spring5-next" }
<<: *slack-failure
- name: Test - JDK 12 and Spring 5.1 (snapshots)
serial: true
public: true
plan:
- get: spring-hateoas-github
trigger: true
- get: openjdk:12-jdk
trigger: true
- task: test
image: openjdk:12-jdk
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "spring51-next" }
<<: *slack-failure
- name: Build
serial: true
public: true
plan:
- get: spring-hateoas-github
trigger: true
passed: [
Test - JDK 8,
Test - JDK 8 and Spring 5.0 (snapshots),
Test - JDK 8 and Spring 5.1 (snapshots),
Test - JDK 11,
Test - JDK 11 and Spring 5.0 (snapshots),
Test - JDK 11 and Spring 5.1 (snapshots),
Test - JDK 12,
Test - JDK 12 and Spring 5.0 (snapshots),
Test - JDK 12 and Spring 5.1 (snapshots)
]
- put: spring-hateoas-status
params:
commit: spring-hateoas-github
state: pending
- task: build
file: spring-hateoas-github/ci/build.yml
- put: spring-hateoas-artifactory
params:
build_number: ${BUILD_NAME}
build_uri: ${ATC_EXTERNAL_URL}/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}
repo: libs-snapshot-local
folder: spring-hateoas-artifactory
artifact_set:
- include:
- "/**"
properties:
archives: '*:*:*:*@zip zip.name:spring-hateoas, zip.displayname:Spring HATEOAS, zip.deployed:false'
on_failure:
aggregate:
- put: spring-hateoas-status
params:
commit: spring-hateoas-github
state: failure
- put: slack
params:
attachments:
- color: danger
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <FAILURE>"
text: "Build has failed"
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
on_success:
aggregate:
- put: spring-hateoas-status
params:
commit: spring-hateoas-github
state: success
- put: slack
params:
attachments:
- color: good
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <SUCCESS>"
text: "Build has succeeded!"
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
- name: spring-hateoas-pull-requests
public: true
plan:
- get: spring-hateoas-github
resource: spring-hateoas-pull-requests
trigger: true
version: every
- get: openjdk:11-jdk
- put: spring-hateoas-pull-requests
params:
path: spring-hateoas-github
status: pending
- aggregate:
- task: test (JDK 8)
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "non-existent" }
- task: test (JDK 8 and Spring 5.0 snapshots)
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "spring5-next" }
- task: test (JDK 8 and Spring 5.1 snapshots)
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "spring51-next" }
- task: test (JDK 11)
image: openjdk:11-jdk
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "non-existent" }
- task: test (JDK 11 and Spring 5.0 snapshots)
image: openjdk:11-jdk
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "spring5-next" }
- task: test (JDK 11 and Spring 5.1 snapshots)
image: openjdk:11-jdk
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "spring51-next" }
- task: test (JDK 12)
image: openjdk:12-jdk
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "non-existent" }
- task: test (JDK 12 and Spring 5.0 snapshots)
image: openjdk:12-jdk
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "spring5-next" }
- task: test (JDK 12 and Spring 5.1 snapshots)
image: openjdk:12-jdk
file: spring-hateoas-github/ci/test.yml
params: { PROFILE: "spring51-next" }
on_failure:
aggregate:
- put: spring-hateoas-pull-requests
params:
path: spring-hateoas-github
status: failure
- put: slack
params:
attachments:
- color: danger
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <FAILURE>"
text: "Pull request has failed"
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
on_success:
aggregate:
- put: spring-hateoas-pull-requests
params:
path: spring-hateoas-github
status: success
- put: slack
params:
attachments:
- color: good
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <SUCCESS>"
text: "Pull request has succeeded!"
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
slack-failure: &slack-failure
on_failure:
put: slack
params:
attachments:
- color: danger
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <FAILURE>"
text: "Test has failed"
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME

11
ci/test.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail
[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2
rm -rf $HOME/.m2/repository/org/springframework/hateoas 2> /dev/null || :
cd spring-hateoas-github
./mvnw clean dependency:list test -P${PROFILE} -Dsort

17
ci/test.yml Normal file
View File

@@ -0,0 +1,17 @@
---
platform: linux
image_resource:
type: docker-image
source:
repository: openjdk
tag: 8-jdk
inputs:
- name: spring-hateoas-github
caches:
- path: maven
run:
path: spring-hateoas-github/ci/test.sh

90
pom.xml
View File

@@ -351,10 +351,47 @@
</goals>
</execution>
<execution>
<id>package-and-attach-docs-zip</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<zip destfile="${project.build.directory}/${project.artifactId}-${project.version}.zip">
<fileset dir="${project.build.directory}/site"/>
</zip>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<id>attach-zip</id>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.artifactId}-${project.version}.zip</file>
<type>zip</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
@@ -377,32 +414,6 @@
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<fromDir>${project.build.directory}</fromDir>
</configuration>
<executions>
<execution>
<id>upload-static-resources</id>
<phase>deploy</phase>
<goals>
<goal>upload</goal>
</goals>
<configuration>
<fromDir>${project.build.directory}/static-resources</fromDir>
<includes>**</includes>
<serverId>static-dot-s2</serverId>
<url>scp://docs.af.pivotal.io</url>
<toDir>/var/www/domains/spring.io/www/htdocs/autorepo/docs/${project.artifactId}/${project.version}</toDir>
<optimize>true</optimize>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
@@ -582,13 +593,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<version>3.8.0</version>
<configuration>
<source>${source.level}</source>
<target>${source.level}</target>
<configuration>
<parameters>true</parameters>
</configuration>
</configuration>
</plugin>
@@ -631,21 +639,35 @@
<source>${source.level}</source>
<quiet>true</quiet>
<additionalparam>-Xdoclint:none</additionalparam>
<stylesheetfile>${shared.resources}/javadoc/spring-javadoc.css</stylesheetfile>
<stylesheetfile>${basedir}/src/main/javadoc/spring-javadoc.css</stylesheetfile>
<links>
<link>http://static.springframework.org/spring/docs/4.1.x/javadoc-api</link>
<link>http://docs.oracle.com/javase/6/docs/api</link>
</links>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>