-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
82 lines (72 loc) · 2.88 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
# This file is a template, and might need editing before it works on your project.
---
variables:
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true -s $CI_PROJECT_DIR/.mvn/local-settings.xml"
SONAR_TOKEN: "750242887444af49d0df0ed38326757676679cd9"
SONAR_HOST_URL: "http://192.168.1.102:30900"
SONAR_USER_HOME: /home/scanner-cli/
GIT_DEPTH: 0
# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache:
paths:
- .m2/repository
stages:
- build
- test
- package
- deploy
# This will only validate and compile stuff and run e.g. maven-enforcer-plugin.
# Because some enforcer rules might check dependency convergence and class duplications
# we use `test-compile` here instead of `validate`, so the correct classpath is picked up.
.validate: &validate
stage: build
script:
- 'mvn $MAVEN_CLI_OPTS test-compile'
sonarqube-check:
stage: test
image: maven:3.3.9-jdk-8
script:
- 'export BUILDCENTER_IP=127.0.0.1'
- 'export BUILDCENTER_PORT=1080'
- 'mvn $MAVEN_CLI_OPTS verify sonar:sonar -Dsonar.qualitygate.wait=true'
allow_failure: true
only:
- merge_requests
- master
# Validate merge requests using JDK8
validate:jdk8:
<<: *validate
image: maven:3.3.9-jdk-8
package:
stage: package
script:
- 'export BUILDCENTER_IP=127.0.0.1'
- 'export BUILDCENTER_PORT=1080'
- 'mvn $MAVEN_CLI_OPTS package'
image: maven:3.3.9-jdk-8
artifacts:
paths:
- MServiceAnalyser/target/*.jar
- MGateway/target/*.jar
- MOrchestrationServer/target/*.jar
- MEurekaServer/target/*.jar
- MInfoCollector/target/*.jar
before_script:
- export DOCKER_HOST="tcp://192.168.1.102:2375"
build:
stage: deploy
script:
- docker info
- docker build $CI_PROJECT_DIR/MServiceAnalyser -t 192.168.1.104:5000/hitices/mserviceanalyser:v1.0
- docker push 192.168.1.104:5000/hitices/mserviceanalyser:v1.0
- docker build $CI_PROJECT_DIR/MGateway -t 192.168.1.104:5000/hitices/mgateway:v1.0
- docker push 192.168.1.104:5000/hitices/mgateway:v1.0
- docker build $CI_PROJECT_DIR/MOrchestrationServer -t 192.168.1.104:5000/hitices/morchestrationserver:v1.0
- docker push 192.168.1.104:5000/hitices/morchestrationserver:v1.0
- docker build $CI_PROJECT_DIR/MEurekaServer -t 192.168.1.104:5000/hitices/meurekaserver:v1.0
- docker push 192.168.1.104:5000/hitices/meurekaserver:v1.0
- docker build $CI_PROJECT_DIR/MInfoCollector -t 192.168.1.104:5000/hitices/minfocollector:v1.0
- docker push 192.168.1.104:5000/hitices/minfocollector:v1.0
image: docker:git