-
Notifications
You must be signed in to change notification settings - Fork 1
/
process.yml
109 lines (108 loc) · 3.47 KB
/
process.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
version: 2
jobs:
build-and-test:
docker:
- image: cimg/openjdk:11.0
steps:
- checkout
- run:
name: Build
command: mvn -B -DskipTests clean package
- run:
name: Test
command: mvn test
build-docker-image:
docker:
- image: docker:17.05.0-ce-git
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: false
- run:
name: install required dependencies
command: |
apt-get update
apt install libxml2-utils
- run:
name: Get Application version from pom.xml
command: |
export TAG="$(echo "cat //*[local-name()='project']/*[local-name()='version']" | xmllint --shell pom.xml | sed '/^\/ >/d' | sed 's/<[^>]*.//g')"
- run:
name: Build Docker image
command: "export IMAGE_NAME=$CIRCLE_PROJECT_REPONAME \ndocker build -t $DOCKER_LOGIN/$IMAGE_NAME -t $DOCKER_LOGIN/$IMAGE_NAME:$TAG .\necho $DOCKERHUB_TOKEN | docker login -u $DOCKER_LOGIN --password-stdin\ndocker push $DOCKER_LOGIN/$IMAGE_NAME\n"
test-pom:
docker:
- image: cimg/openjdk:11.0
steps:
- checkout
- run:
name: install required dependencies
command: sudo apt install libxml2-utils
- run:
name: Get Application version from pom.xml
command: |
export TAG="$(echo "cat //*[local-name()='project']/*[local-name()='version']" | xmllint --shell pom.xml | sed '/^\/ >/d' | sed 's/<[^>]*.//g')"
echo $TAG
workflows:
build-test-publish-to-dockerhub:
jobs:
- build-and-test
- build-docker-image
- test-pom
version: 2
# Original config.yml file:
# version: 2.1
# jobs:
# build-and-test:
# docker:
# - image: cimg/openjdk:11.0
# steps:
# - checkout
# - run:
# name: Build
# command: mvn -B -DskipTests clean package
# - run:
# name: Test
# command: mvn test
# build-docker-image:
# docker:
# - image: docker:17.05.0-ce-git
# steps:
# - checkout
# - setup_remote_docker:
# docker_layer_caching: false
# - run:
# name: install required dependencies
# command: |
# apt-get update
# apt install libxml2-utils
# - run:
# name: Get Application version from pom.xml
# command: |
# export TAG=\"$(echo \"cat //*[local-name()='project']/*[local-name()='version']\" | xmllint --shell pom.xml | sed '/^\\/ >/d' | sed 's/<[^>]*.//g')\"
# - run:
# name: Build Docker image
# command: |
# export IMAGE_NAME=$CIRCLE_PROJECT_REPONAME
# docker build -t $DOCKER_LOGIN/$IMAGE_NAME -t $DOCKER_LOGIN/$IMAGE_NAME:$TAG .
# echo $DOCKERHUB_TOKEN | docker login -u $DOCKER_LOGIN --password-stdin
# docker push $DOCKER_LOGIN/$IMAGE_NAME
# test-pom:
# docker:
# - image: cimg/openjdk:11.0
# steps:
# - checkout
# - run:
# name: install required dependencies
# command: sudo apt install libxml2-utils
# - run:
# name: Get Application version from pom.xml
# command: |
# export TAG=\"$(echo \"cat //*[local-name()='project']/*[local-name()='version']\" | xmllint --shell pom.xml | sed '/^\\/ >/d' | sed 's/<[^>]*.//g')\"
# echo $TAG
# workflows:
# build-test-publish-to-dockerhub:
# jobs:
# - build-and-test
# - build-docker-image
# - test-pom