forked from RIPE-NCC/whois
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
196 lines (166 loc) · 5.46 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
image: $CI_REGISTRY/swe-database-team/gitlab-ci/whois-build:6113670d
variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
TZ: Europe/Amsterdam
WS_MAVEN_AGGREGATEMODULES: "true"
PROJECT_NAME: "whois"
ARTIFACT_NAME: "whois-db"
ARTIFACT_DIR: "whois-db"
GROUP_ID: "net.ripe.db"
include:
- project: 'swe-database-team/gitlab-ci'
file: '/templates/release-template.yml'
- project: 'swe-database-team/gitlab-ci'
file: '/templates/deployment-template.yml'
- project: 'swe-database-team/gitlab-ci'
file: '/templates/deployment-salt-template.yml'
stages:
- build
- test
- integration-test
- code_quality
- release
- deploy
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .m2/repository
build:
tags:
- whois
stage: build
script:
- mvn $MAVEN_OPTS clean install -Prelease
artifacts:
paths:
- "*/target/*.jar"
reports:
junit:
- "*/target/surefire-reports/TEST-*.xml"
- "*/target/failsafe-reports/TEST-*.xml"
release:
stage: release
only:
- tags
script:
- if [ "$CI_COMMIT_TAG" ]; then NEW_VERSION="$CI_COMMIT_SHORT_SHA"; else NEW_VERSION="$CI_COMMIT_SHORT_SHA-SNAPSHOT"; fi
- mvn versions:set -DnewVersion=$NEW_VERSION
- mvn -DskipTests -DskipITs -Prelease deploy
extends: .release_template
.it_template: &it_env
tags:
- whois
stage: integration-test
rules:
- if: '$CI_COMMIT_REF_NAME == "master"'
when: always
- when: manual
allow_failure: true
artifacts:
reports:
junit:
- "*/target/surefire-reports/TEST-*.xml"
- "*/target/failsafe-reports/TEST-*.xml"
paths:
- "*/target/*.jar"
.mariadb_template: &mariadb_configuration
variables:
MYSQL_ROOT_PASSWORD: root
TZ: Europe/Amsterdam
before_script:
- mysql -uroot -proot -h mariadb -e "CREATE USER 'dbint'@'%' IDENTIFIED BY '';"
- mysql -uroot -proot -h mariadb -e "GRANT ALL ON *.* TO 'dbint'@'%' WITH GRANT OPTION;"
- mysql -uroot -proot -h mariadb -e "SET GLOBAL innodb_file_per_table = 0;"
- mysql -uroot -proot -h mariadb -e "SET GLOBAL innodb_buffer_pool_size = 2147483648;"
- mysql -uroot -proot -h mariadb -e "SET GLOBAL max_connections=10000;"
services: &mariadb_service
- mariadb:10.2
whois-groovy:
<<:
- *it_env
- *mariadb_configuration
script:
- mvn $MAVEN_OPTS -Ddb.host=mariadb verify -PintegrationAll -pl whois-endtoend
whois-api:
<<:
- *it_env
- *mariadb_configuration
services:
- *mariadb_service
- name: docker.elastic.co/elasticsearch/elasticsearch:7.15.0
alias: "elasticsearch"
command: [ "bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node" ]
script:
- mvn $MAVEN_OPTS -Ddb.host=mariadb verify -Pintegration -pl whois-api
whois-client:
<<:
- *it_env
- *mariadb_configuration
script:
- mvn $MAVEN_OPTS -Ddb.host=mariadb verify -PintegrationAll -pl whois-client
whois-commons:
<<:
- *it_env
- *mariadb_configuration
script:
- mvn $MAVEN_OPTS -Ddb.host=mariadb verify -PintegrationAll -pl whois-commons -T 1
whois-db:
<<:
- *it_env
- *mariadb_configuration
script:
- mvn $MAVEN_OPTS -Ddb.host=mariadb verify -PintegrationAll -pl whois-db
whois-nrtm:
<<:
- *it_env
- *mariadb_configuration
script:
- mvn $MAVEN_OPTS -Ddb.host=mariadb verify -PintegrationAll -pl whois-nrtm
whois-query:
<<:
- *it_env
- *mariadb_configuration
script:
- mvn $MAVEN_OPTS -Ddb.host=mariadb verify -PintegrationAll -pl whois-query -T 1
whois-rpsl:
<<:
- *it_env
- *mariadb_configuration
script:
- mvn $MAVEN_OPTS -Ddb.host=mariadb verify -PintegrationAll -pl whois-rpsl
whois-scheduler:
<<:
- *it_env
- *mariadb_configuration
script:
- mvn $MAVEN_OPTS -Ddb.host=mariadb verify -PintegrationAll -pl whois-scheduler
whois-update:
<<:
- *it_env
- *mariadb_configuration
script:
- mvn $MAVEN_OPTS -Ddb.host=mariadb verify -PintegrationAll -pl whois-update
sonar:
<<: *mariadb_configuration
variables:
GIT_SUBMODULE_STRATEGY: recursive
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
stage: code_quality
only:
- schedules
tags:
- whois
script:
- mvn install
- mvn $MAVEN_OPTS -Ddb.host=mariadb verify -Pall -fn # ignore failing (non deterministic) tests, we want QA output regardless
- echo PWD=$PWD
- mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectVersion=$CI_COMMIT_SHORT_SHA -Dsonar.projectKey=whois -Dsonar.host.url=${SONAR_HOST_URL} -Dsonar.login=${SONAR_TOKEN} -Dsonar.projectName=whois -Dsonar.coverage.jacoco.xmlReportPaths=$PWD/whois-api/target/site/jacoco-merged-test-coverage-report/jacoco.xml,$PWD/whois-client/target/site/jacoco-merged-test-coverage-report/jacoco.xml,$PWD/whois-commons/target/site/jacoco-merged-test-coverage-report/jacoco.xml,$PWD/whois-db/target/site/jacoco-merged-test-coverage-report/jacoco.xml,$PWD/whois-nrtm/target/site/jacoco-merged-test-coverage-report/jacoco.xml,$PWD/whois-query/target/site/jacoco-merged-test-coverage-report/jacoco.xml,$PWD/whois-rpsl/target/site/jacoco-merged-test-coverage-report/jacoco.xml,$PWD/whois-scheduler/target/site/jacoco-merged-test-coverage-report/jacoco.xml -Dsonar.test.exclusions=**/test/*
artifacts:
reports:
junit:
- "*/target/surefire-reports/TEST-*.xml"
- "*/target/failsafe-reports/TEST-*.xml"
deploy_salt_prod:
stage: deploy
only:
- /^never$/