-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
124 lines (115 loc) · 3.04 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
stages:
- test
- build image
- trigger deploy
- static scans
- publish pages
variables:
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "campaigner"
MYSQL_USER: "campaigner"
MYSQL_PASSWORD: "campaigner"
# VAULT_ADDR: defined in GitLab variables
# 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
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://docker:2375
default:
services:
- name: mariadb:10.4.31
alias: db
command:
- --character-set-server=utf8
- --collation-server=utf8_unicode_ci
- --max_connections=1000
test:
stage: test
image: $TEST_IMAGE
except:
refs:
- deploy/sit
variables:
DB_URL: "jdbc:mariadb://db:3306/campaigner"
before_script:
- echo "GRANT ALL PRIVILEGES ON \`campaigner%\`.* TO 'campaigner'@'%'; FLUSH PRIVILEGES;" > db_user.sql
- mysqladmin ping --protocol=TCP -h db -P 3306 -u root -proot
- mysql -v -h db -u root -proot < db_user.sql
script:
- sbt -sbt-dir ./.sbt -ivy ./.ivy2 -J-Xmx1G -J-XX:MaxPermSize=256m -J-XX:ReservedCodeCacheSize=128m clean coverage test
artifacts:
paths:
- "target/scala-*/scoverage-data"
- "target/scala-*/src_managed"
- "target/scala-*/classes"
cache:
paths:
- .ivy2/
- .sbt/
code coverage:
extends: .report_scala_coverage
needs: ["test"]
except:
refs:
- deploy/sit
allow_failure: true
image: $TEST_IMAGE_SONAR
build docker image:
stage: build image
except:
refs:
- schedules
- deploy/sit
only:
refs:
- master
- /^deploy/.*$/
image: advancedtelematic/gitlab-jobs:0.3.3
services:
- docker:19.03.12-dind
script:
- env | sort
- gitlab-docker-login $VAULT_ADDR
- sbt -x -sbt-dir ./.sbt -ivy ./.ivy2 -batch docker:publish -J-Xmx1G -J-XX:MaxPermSize=256m -J-XX:ReservedCodeCacheSize=128m -Dsbt.log.noformat=true
- docker tag advancedtelematic/campaigner:${CI_COMMIT_SHA} hcr.data.here.com/ota_saas/campaigner:${CI_COMMIT_SHA}
- docker push hcr.data.here.com/ota_saas/campaigner:${CI_COMMIT_SHA}
cache:
paths:
- .ivy2/
- .sbt/
trigger dev deploy:
stage: trigger deploy
except:
- schedules
only:
- master
variables:
ENV: "dev"
NEW_TAG: $CI_COMMIT_SHA
SERVICE: $CI_PROJECT_NAME
CREATE_COMMIT: "true"
UPSTREAM_COMMIT_MESSAGE: $CI_COMMIT_MESSAGE
trigger:
project: OLP/EDGE/OTA/infra/deployment-descriptors
branch: master
trigger sit deploy:
stage: trigger deploy
except:
- schedules
only:
- deploy/sit
variables:
ENV: "sit"
NEW_TAG: $CI_COMMIT_SHA
SERVICE: $CI_PROJECT_NAME
CREATE_COMMIT: "true"
UPSTREAM_COMMIT_MESSAGE: $CI_COMMIT_MESSAGE
trigger:
project: OLP/EDGE/OTA/infra/deployment-descriptors
branch: master
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