-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
61 lines (56 loc) · 2.13 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
stages:
- build
- deploy
variables:
DOCKER_DRIVER: overlay
DOCKER_HOST: tcp://localhost:2375
DOCKER_TLS_CERTDIR: ""
IMAGE_TAG: $CI_COMMIT_SHORT_SHA
REPOSITORY: eu.gcr.io/second-caster-232215
GCE_PROJECT: second-caster-232215
GKE_CLUSTER_NAME: demo1
GKE_CLUSTER_ZONE: europe-west3-a
### FUNCTION
.build:
stage: build
image: docker
services:
- docker:19.03.0-dind
script:
- echo $GCE_KEY_DEV | docker login -u _json_key --password-stdin https://eu.gcr.io
- echo "Buiding service $SERVICE"
- docker build . -t $REPOSITORY/$SERVICE:$IMAGE_TAG --build-arg SERVICE=$SERVICE
- docker push $REPOSITORY/$SERVICE:$IMAGE_TAG
.deploy:
stage: deploy
image: eu.gcr.io/second-caster-232215/common/alvaro-gitlab-runner
script:
- |
echo "$GCE_KEY_DEV" > /tmp/1.json
gcloud auth activate-service-account $GCE_SA_DEV --key-file=/tmp/1.json
gcloud --project $GCE_PROJECT container clusters get-credentials $GKE_CLUSTER_NAME --zone $GKE_CLUSTER_ZONE
rm -f /tmp/1.json
- |
helm upgrade $SERVICE ./deploy/do --namespace $NAMESPACE --install \
--set image.repository=$REPOSITORY/$SERVICE \
--set image.tag=$IMAGE_TAG \
--set config.ambiente=$AMBIENTE \
--set config.virtualService.enabled=$VIRTUAL_SERVICE_ENABLED \
--set config.virtualService.gateways=$GATEWAY \
--set config.virtualService.hosts=$HOST \
--set config.virtualService.path=$SERVICE_PATH
### JOB
include:
- local: "/.gitlab-ci/do-al-collector-service.yml"
- local: "/.gitlab-ci/do-ap-collector-service.yml"
- local: "/.gitlab-ci/do-api-collector-service.yml"
- local: "/.gitlab-ci/do-df-collector-service.yml"
- local: "/.gitlab-ci/do-ma-collector-service.yml"
- local: "/.gitlab-ci/do-pa-collector-service.yml"
- local: "/.gitlab-ci/do-pe-collector-service.yml"
- local: "/.gitlab-ci/do-pi-collector-service.yml"
- local: "/.gitlab-ci/do-trf1-collector-service.yml"
- local: "/.gitlab-ci/do-trf2-collector-service.yml"
- local: "/.gitlab-ci/do-trf3-collector-service.yml"
- local: "/.gitlab-ci/do-trf4-collector-service.yml"
- local: "/.gitlab-ci/do-trf5-collector-service.yml"