-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
107 lines (93 loc) · 2.54 KB
/
.gitlab-ci.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
# Gitlab CI definition for def-pi
#
# This file is based on the official docker maven template
#
# author: C.J. van Leeuwen
# since: 2-6-2017
variables:
MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true -Dmaven.repo.local=cache/maven.repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1"
MAVEN_CLI_OPTS: "-T4 --batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
JDK_8_IMAGE: maven:3.8.1-openjdk-8-slim
JDK_11_IMAGE: maven:3.8.1-openjdk-11-slim
JDK_14_IMAGE: maven:3.6.3-openjdk-14-slim
DOCKER_IMAGE: docker:19.03.13-git
BUSYBOX_IMAGE: busybox:latest
# Validate java code; usually this is a sanity check
.java-compile: &compile
stage: build
script:
- mvn $MAVEN_CLI_OPTS -f master/pom.xml clean test-compile
cache:
paths:
- cache/maven.repository
java-compile:jdk8:
<<: *compile
image: $JDK_8_IMAGE
java-compile:jdk11:
<<: *compile
image: $JDK_11_IMAGE
java-compile:jdk14:
<<: *compile
image: $JDK_14_IMAGE
# Compile the orchestrator-ui
ui-compile:
image: $DOCKER_IMAGE
stage: build
script:
- docker build orchestrator-ui
# *** TEST JOBS *** #
# Run Junit tests with maven; not on master where we will deploy
.java-test: &test
stage: test
except:
- master
script:
- mvn $MAVEN_CLI_OPTS -f master/pom.xml package
cache:
paths:
- cache/maven.repository
artifacts:
when: always
reports:
junit:
- ./*/target/surefire-reports/TEST-*.xml
java-test:jdk8:
<<: *test
needs:
- java-compile:jdk8
image: $JDK_8_IMAGE
java-test:jdk11:
<<: *test
needs:
- java-compile:jdk11
image: $JDK_11_IMAGE
java-test:jdk14:
<<: *test
needs:
- java-compile:jdk14
image: $JDK_14_IMAGE
# *** DEPLOYMENT JOBS *** #
# Deploy the complete project with modules to artifactory and the orchestrator to registry
java-deploy:
stage: deploy
only:
- master
- defpici
image: $JDK_8_IMAGE
script:
- mvn $MAVEN_CLI_OPTS -f master/pom.xml deploy -Ddocker.registry=$CI_REGISTRY
cache:
paths:
- cache/maven.repository
# Deploy UI to registry
ui-deploy:
stage: deploy
only:
- master
- defpici
image: $DOCKER_IMAGE
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build orchestrator-ui -t $CI_REGISTRY/defpi/orchestrator-ui
- docker push $CI_REGISTRY/defpi/orchestrator-ui