-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
131 lines (122 loc) · 3.17 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
stages:
- prepare
- test
- build image
- trigger deploy
- static scans
- publish pages
variables:
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "director_test"
MYSQL_USER: "director_v2"
MYSQL_PASSWORD: "director_v2"
# VAULT_ADDR: defined in GitLab variables
SERVICE_IMAGE: "advancedtelematic/director"
# 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
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
except:
refs:
- deploy/sit
image: $TEST_IMAGE
except:
refs:
- deploy/sit
variables:
DB_URL: "jdbc:mariadb://db:3306/$MYSQL_DATABASE"
SONAR_USER_HOME: $CI_PROJECT_DIR/.caches/sonar
before_script:
- echo "GRANT ALL PRIVILEGES ON \`director%\`.* TO 'director_v2'@'%'; 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 -Dsbt.override.build.repos=true -Dsbt.repository.config=sbt-repositories.conf clean compile 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
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/.*$/
variables:
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://docker:2375
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
- docker tag advancedtelematic/director-v2:${CI_COMMIT_SHA} hcr.data.here.com/ota_saas/director-v2:${CI_COMMIT_SHA}
- docker push hcr.data.here.com/ota_saas/director-v2:${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:
- template: SAST.gitlab-ci.yml
- 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