Skip to content
This repository was archived by the owner on Jul 19, 2022. It is now read-only.

Commit 0ac8ddc

Browse files
Merge pull request #1 from Pivotal-Field-Engineering/master
Merge latest from Pivotal-Field-Engineering
2 parents 893189f + 3148418 commit 0ac8ddc

20 files changed

+529
-231
lines changed

.mvn/wrapper/maven-wrapper.jar

17 Bytes
Binary file not shown.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ Additional fun: click "Kill App" and watch the application crashing.. it will sh
1616

1717
## Concourse CI Pipeline
1818

19-
Please take a look at the ci folder to see the Concourse CI Pipeline.
19+
Please take a look at the [ci](ci/README.md) folder to see the [Concourse](http://concourse.ci/) CI Pipeline.

ci/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ The end-to-end scenario is to monitor a Git repository for commits, and when new
99
commits are detected, run its unit tests.
1010

1111
If the unit tests pass, the pipeline will then create a new release candidate
12-
artifact with automated versioning, which then will be placed in a S3 bucket.
12+
artifact with automated versioning, which then will be placed in a S3 bucket. From there, the pipeline will run integration tests against the release candidate.
1313

14-
From there, the pipeline will run integration tests against the release candidate,
15-
and if those pass, it will create a final artifact and "ship it" by putting it in
16-
a different S3 bucket.
14+
These tasks comprise the automated continuous integration part of the pipeline. Once
15+
a candidate-release is properly vetted, the "ship-it" task can be manually invoked to
16+
put the final-release version in a different S3 bucket.
1717

1818
## Prerequisites
1919

@@ -28,6 +28,10 @@ day trial, or [MicroPCF](https://micropcf.io) to run locally)
2828
## Concourse Setup
2929

3030
If you have an existing Concourse CI system setup, skip to the next section.
31+
32+
> NOTE: The pipeline and scripts used in this project have been tested on Concourse
33+
**v0.72.1**. If you experience any problems, please ensure you are running a current version of Concourse, and remember to `fly sync` !
34+
3135
Otherwise if you just want to quickly start up Concourse on your local machine you
3236
can use the pre-built [Vagrant](https://www.vagrantup.com/) box:
3337

ci/pcfdemo-properties-sample.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
github-uri: https://github.com/.../PCF-demo.git
2-
s3-access-key-id: SAMPLEDF99FSWEBF9DW9
3-
s3-secret-access-key: sampleaxfdpiA98FG8u7ahd08Sdgf8AFG8gh8S0F
2+
github-branch: master
3+
s3-access-key-id: SAMPLEDF99FSWEBF9DW9 # AWS or S3 compatible access key id
4+
s3-secret-access-key: sampleaxfdpiA98FG8u7ahd08Sdgf8AFG8gh8S0F # AWS or S3 compatible secret access key
45
s3-endpoint: s3.amazonaws.com
56
s3-bucket-version: pcfdemo-releases
67
s3-bucket-releases: pcfdemo-releases
78
s3-bucket-release-candidates: pcfdemo-release-candidates
9+
maven-opts: # -Xms256m -Xmx512m
10+
maven-config: # -s path/to/settings.xml
811
cf-api: https://api.local.micropcf.io
912
cf-username: admin
1013
cf-password: admin
1114
cf-org: micropcf-org
1215
cf-space: micropcf-space
16+
cf-manifest-host: pcfdemo-ci
1317
github-private-key: |
1418
-----BEGIN RSA PRIVATE KEY-----
1519
SamplejjkKiRxGdgR8p5kZJj0AFgdWYa3OT2snIXnN5+/p7j13PSkseUcrAFyokc

ci/pipeline.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ resources:
44
type: git
55
source:
66
uri: {{github-uri}}
7-
branch: master
7+
branch: {{github-branch}}
88

99
- name: version
1010
type: semver
1111
source:
1212
bucket: {{s3-bucket-version}}
13-
initial_version: 1.0.0-rc.1
13+
initial_version: 1.0.0-rc.0
1414
key: current-version
1515
access_key_id: {{s3-access-key-id}}
1616
secret_access_key: {{s3-secret-access-key}}
@@ -52,6 +52,10 @@ jobs:
5252
trigger: true
5353
- task: unit
5454
file: pcfdemo/ci/tasks/unit.yml
55+
config:
56+
params: &MAVENPARAMS
57+
MAVEN_OPTS: {{maven-opts}}
58+
MAVEN_CONFIG: {{maven-config}}
5559

5660
- name: build-artifact
5761
serial_groups: [ version ]
@@ -63,10 +67,11 @@ jobs:
6367
params: { pre: rc }
6468
- task: build
6569
file: pcfdemo/ci/tasks/build.yml
66-
- task: prepare-build
67-
file: pcfdemo/ci/tasks/prepare-build.yml
70+
config:
71+
params:
72+
<<: *MAVENPARAMS
6873
- put: candidate-release
69-
params: { from: prepare-build/pcf-demo-(.*).war }
74+
params: { from: build/pcf-demo-(.*).war }
7075
- put: version
7176
params: { file: version/number }
7277

@@ -82,12 +87,17 @@ jobs:
8287
passed: [ build-artifact ]
8388
- task: prepare-integration
8489
file: pcfdemo/ci/tasks/prepare-integration.yml
90+
config:
91+
params:
92+
CF_MANIFEST_HOST: {{cf-manifest-host}}
8593
- put: cf
8694
params:
87-
manifest: pcfdemo/manifest.yml
88-
path: prepare-integration/pcf-demo.war
95+
manifest: prepare-integration/manifest.yml
8996
- task: integration
9097
file: pcfdemo/ci/tasks/integration.yml
98+
config:
99+
params:
100+
<<: *MAVENPARAMS
91101

92102
- name: ship-it
93103
serial_groups: [ version ]

ci/tasks/build.sh

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,64 @@
11
#!/bin/sh
22

3-
# Set the basedir for Maven wrapper script to find the .mvn folder
4-
export MAVEN_BASEDIR=pcfdemo
3+
inputDir= outputDir= versionFile= artifactId= packaging=
54

6-
pcfdemo/mvnw --file=pcfdemo/pom.xml clean package
5+
while [ $# -gt 0 ]; do
6+
case $1 in
7+
-i | --input-dir )
8+
inputDir=$2
9+
shift
10+
;;
11+
-o | --output-dir )
12+
outputDir=$2
13+
shift
14+
;;
15+
-v | --version-file )
16+
versionFile=$2
17+
shift
18+
;;
19+
-a | --artifactId )
20+
artifactId=$2
21+
shift
22+
;;
23+
-p | --packaging )
24+
packaging=$2
25+
shift
26+
;;
27+
* )
28+
echo "Unrecognized option: $1" 1>&2
29+
exit 1
30+
;;
31+
esac
32+
shift
33+
done
34+
35+
error_and_exit() {
36+
echo $1 >&2
37+
exit 1
38+
}
39+
40+
if [ ! -d "$inputDir" ]; then
41+
error_and_exit "missing input directory: $inputDir"
42+
fi
43+
if [ ! -d "$outputDir" ]; then
44+
error_and_exit "missing output directory: $outputDir"
45+
fi
46+
if [ ! -f "$versionFile" ]; then
47+
error_and_exit "missing version file: $versionFile"
48+
fi
49+
if [ -z "$artifactId" ]; then
50+
error_and_exit "missing artifactId!"
51+
fi
52+
if [ -z "$packaging" ]; then
53+
error_and_exit "missing packaging!"
54+
fi
55+
56+
version=`cat $versionFile`
57+
artifactName="${artifactId}-${version}.${packaging}"
58+
59+
cd $inputDir
60+
./mvnw clean package -Pci -DversionNumber=$version
61+
62+
# Copy war file to concourse output folder
63+
cd ..
64+
cp $inputDir/target/$artifactName $outputDir/$artifactName

ci/tasks/build.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
---
22
platform: linux
3+
34
image: docker:///java#8
5+
6+
params:
7+
MAVEN_OPTS:
8+
MAVEN_CONFIG:
9+
410
inputs:
511
- name: pcfdemo
12+
- name: version
13+
14+
outputs:
15+
- name: build
16+
617
run:
718
path: pcfdemo/ci/tasks/build.sh
19+
args: [
20+
--input-dir, pcfdemo,
21+
--output-dir, build,
22+
--version-file, version/number,
23+
--artifactId, pcf-demo,
24+
--packaging, war
25+
]

ci/tasks/integration.sh

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
#!/bin/sh
22

3-
# Set the basedir for Maven wrapper script to find the .mvn folder
4-
export MAVEN_BASEDIR=pcfdemo
3+
inputDir=
54

6-
pcfdemo/mvnw --file=pcfdemo/pom.xml clean verify
5+
while [ $# -gt 0 ]; do
6+
case $1 in
7+
-i | --input-dir )
8+
inputDir=$2
9+
shift
10+
;;
11+
* )
12+
echo "Unrecognized option: $1" 1>&2
13+
exit 1
14+
;;
15+
esac
16+
shift
17+
done
18+
19+
error_and_exit() {
20+
echo $1 >&2
21+
exit 1
22+
}
23+
24+
if [ ! -d "$inputDir" ]; then
25+
error_and_exit "missing input directory: $inputDir"
26+
fi
27+
28+
cd $inputDir
29+
30+
./mvnw clean verify

ci/tasks/integration.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
---
22
platform: linux
3+
34
image: docker:///java#8
5+
46
inputs:
57
- name: pcfdemo
8+
69
run:
710
path: pcfdemo/ci/tasks/integration.sh
11+
args: [
12+
--input-dir, pcfdemo
13+
]

ci/tasks/prepare-build.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)