Skip to content

Commit 49d8d06

Browse files
committedJan 16, 2020
Pipeline with version reading
1 parent adb688b commit 49d8d06

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed
 

‎README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Example Java project with Docker and integration tests
22

33
Workshop material for Codefresh
4+
5+
![Final pipeline](final-pipeline.png)

‎codefresh-5.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
version: "1.0"
2+
stages:
3+
- prepare
4+
- test
5+
- build
6+
- 'integration test'
7+
steps:
8+
main_clone:
9+
type: "git-clone"
10+
stage: prepare
11+
description: "Cloning main repository..."
12+
repo: '${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}'
13+
revision: "${{CF_BRANCH}}"
14+
read_mvn_coords:
15+
title: Reading Maven coordinates
16+
stage: prepare
17+
type: kostis-codefresh/mvn-version
18+
arguments:
19+
POM_XML_FOLDER: './codefresh-java-workshop'
20+
get_app_version:
21+
title: Getting app version
22+
stage: prepare
23+
image: stedolan/jq:master
24+
commands:
25+
- echo $MVN_COORDS
26+
- cf_export APP_VERSION=$(echo $MVN_COORDS | jq -r .version)
27+
run_unit_tests:
28+
title: Compile/Unit test
29+
stage: test
30+
image: 'maven:3.5.2-jdk-8-alpine'
31+
commands:
32+
- mvn -Dmaven.repo.local=/codefresh/volume/m2_repository package
33+
build_app_image:
34+
title: Building Docker Image
35+
type: build
36+
stage: build
37+
image_name: spring-boot-2-example-app
38+
working_directory: ./
39+
tag: '${{APP_VERSION}}'
40+
dockerfile: Dockerfile
41+
run_integration_tests:
42+
title: Integration test
43+
stage: 'integration test'
44+
image: maven:3.5.2-jdk-8-alpine
45+
commands:
46+
- mvn -Dmaven.repo.local=/codefresh/volume/m2_repository verify -Dserver.host=http://my-spring-app
47+
services:
48+
composition:
49+
my-spring-app:
50+
image: '${{build_app_image}}'
51+
ports:
52+
- 8080
53+
readiness:
54+
timeoutSeconds: 30
55+
periodSeconds: 20
56+
failureThreshold: 4
57+
image: byrnedo/alpine-curl
58+
commands:
59+
- "curl http://my-spring-app:8080/"

‎final-pipeline.png

117 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.