This repository has been archived by the owner on Dec 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
68 lines (61 loc) · 1.89 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
stages:
- test
- build image
- deploy
variables:
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
SBT_OPTS: "-sbt-launch-dir .sbt/launchers -sbt-dir .sbt -ivy .ivy2 -Dsbt.color=true -Dscala.color=true"
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "device_registry"
MYSQL_USER: "device_registry"
MYSQL_PASSWORD: "device_registry"
POSTGRES_USER: "device_monitoring"
POSTGRES_PASSWORD: "password"
SERVICE: "device-registry"
image: registry.gitlab.com/torizon-platform/ci-container-build:scala-jvm17-0.0.5
include:
- project: torizon-platform/ci-container-build
file: gitlab-ci-templates/gitlab-sbt-docker-publish.yaml
ref: master
- project: 'torizon-platform/deploy-env'
ref: master
file: '/gitlab/deploy-core-service.yml'
services:
- name: docker:dind
default:
cache:
when: always
key: device-registry
paths:
- .ivy2/
- .sbt/
test:
stage: test
rules:
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
services:
- name: mariadb:10.4
alias: db
command:
- --character-set-server=utf8
- --collation-server=utf8_unicode_ci
- --max_connections=1000
variables:
DB_URL: "jdbc:mariadb://db:3306/device_registry"
before_script:
- echo "CREATE DATABASE device_registry_test; CREATE DATABASE device_registry_ptest; GRANT ALL PRIVILEGES ON \`device\_registry%\`.* TO 'device_registry'@'%'; FLUSH PRIVILEGES; " > db_user.sql
- until mysqladmin ping --protocol=TCP -h db -P 3306 -u root -proot; do echo waiting for mysql; sleep 1; done
- mysql -v -h db -u root -proot < db_user.sql
script:
- sbt test
build docker image:
stage: build image
rules:
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
extends: .sbt-docker-publish
variables:
SERVICE_NAME: device-registry