-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
90 lines (83 loc) · 2.58 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
stages:
- test
- publish
- static scans
- publish pages
variables:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: libats_slick
MYSQL_PASSWORD: libats_slick
MYSQL_DATABASE: libats_slick
DB_URL: jdbc:mariadb://mariadb:3306/libats_slick
KAFKA_HOST: kafka:9092
KAFKA_ZOOKEEPER_CONNECT: kafka:2181
VAULT_ADDR: "http://vault.sit-ota.aws.in.here.com"
# The same image have to be used by test and code coverage jobs:
TEST_IMAGE: advancedtelematic/gitlab-jobs:0.2.5
TEST_IMAGE_SONAR: advancedtelematic/gitlab-jobs-sonar:0.0.3
services:
- name: mariadb:10.2
command: ["mysqld", "--character-set-server=utf8", "--collation-server=utf8_unicode_ci", "--max_connections=1000"]
- name: spotify/kafka
alias: kafka
test:
image: $TEST_IMAGE
# Keep image in sync with code coverage job below
stage: test
before_script:
- mysql --protocol=TCP --host=mariadb --user=root --port 3306 -proot -e \ GRANT\ ALL\ PRIVILEGES\ ON\ \`libats_slick%\`.\*\ TO\ \'libats_slick\'@\'%\'\;
script:
- sbt -sbt-dir ./.sbt -ivy ./.ivy2 clean coverage test
artifacts:
paths:
- "libats*/target/scala-*/scoverage-data"
- "libats*/target/scala-*/src_managed"
- "libats*/target/scala-*/classes"
cache:
paths:
- .ivy2/
- .sbt/
code coverage:
extends: .report_scala_coverage
needs: ["test"]
image: $TEST_IMAGE_SONAR
allow_failure: true
script:
- sbt -Dsonar.login=$SONARQUBE_TOKEN -sbt-dir ./.sbt -ivy ./.ivy2 coverageReport sonarScan
# remove unneeded files just to copy all required directories in 'for' cycle
- rm -rf libats-metrics-finagle libats_dependencies.png
- for i in $(ls -d *libats* | grep -v / | grep -v /) ; do mv $i/target/scala-*/scoverage-report/ $i-coverage ; done
artifacts:
expire_in: 3 weeks
paths:
- libats*-coverage
reports:
coverage_report:
coverage_format: cobertura
path: "libats*/target/scala-*/coverage-report/cobertura.xml"
publish:
stage: publish
tags:
- docker-sock
image: advancedtelematic/gitlab-jobs:0.2.5
only:
- master
except:
- schedules
script:
- git fetch origin
- git describe
- export VAULT_TOKEN=$(cat /opt/vault/token)
- gitlab-docker-login $VAULT_ADDR
- eval $(set-vault-env -v $VAULT_ADDR --secret gitlab/ats-aws-key --secret gitlab/maven-publish)
- sbt -sbt-dir ./.sbt -ivy ./.ivy2 +publish
cache:
paths:
- .ivy2/
- .sbt/
include:
- project: "poit/spc/be/prodsec-secret-detection"
file: "ITT-Secret-Detection.gitlab-ci.yml"
- project: olp/edge/ota/infra/security
ref: v0.1.1
file: /shared.yaml