-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
65 lines (59 loc) · 1.64 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
image: alpine/helm
variables:
SERVICE_NAME: report-generator
REPO: asia-southeast2-docker.pkg.dev/finnet-artifact-cde/finnet-cde-repo
NAMESPACE: finpay-cde
stages:
- build
- deploy
build:
stage: build
image: docker:20-dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- name: docker:20-dind
alias: docker
command: ["--tls=false","--mtu=1300"]
before_script:
- cat $GCP_KEYS_DEV | docker login -u _json_key --password-stdin https://$REPO
- if [ "$CI_COMMIT_BRANCH" == "master" ]; then VERSION=$CI_PIPELINE_IID; else VERSION=$CI_COMMIT_TAG; fi;
only:
refs:
- tags
- master
script:
- docker build -t $SERVICE_NAME:$VERSION .
- docker image ls
- docker tag $SERVICE_NAME:$VERSION $REPO/$SERVICE_NAME:$VERSION
- docker push $REPO/$SERVICE_NAME:$VERSION
deploy_staging:
stage: deploy
tags:
- kubedev
variables:
VERSION: $CI_PIPELINE_IID
DEPLOY_ENVIRONMENT: "finpay-cde-dev"
only:
refs:
- master
when: on_success
script:
- sed -i "s|J_APP_VERSION|$VERSION|g" helm/Chart.yaml
- helm upgrade --install $SERVICE_NAME helm -f helm/$DEPLOY_ENVIRONMENT.yaml -n $NAMESPACE --wait --timeout 5m0s --debug
deploy_production:
stage: deploy
tags:
- kubeprod
variables:
VERSION: $CI_COMMIT_TAG
DEPLOY_ENVIRONMENT: "finpay-cde-prod"
only:
refs:
- tags
when: manual
script:
- sed -i "s|J_APP_VERSION|$VERSION|g" helm/Chart.yaml
- helm upgrade --install $SERVICE_NAME helm -f helm/$DEPLOY_ENVIRONMENT.yaml -n $NAMESPACE --wait --timeout 5m0s --debug