-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
96 lines (85 loc) · 2.71 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
stages:
- build
- deploy
variables:
#GLOBAL
IMAGE_NAME: slashing-protector
#STAGE
ACCOUNT_ID_INFRA_STAGE: 121827225315
AWS_REGION_INFRA_STAGE: "us-west-2"
DOCKER_REPO_INFRA_STAGE: $ACCOUNT_ID_INFRA_STAGE.dkr.ecr.$AWS_REGION_INFRA_STAGE.amazonaws.com/$IMAGE_NAME
APP_REPLICAS_INFRA_STAGE: "1"
ECRLOGIN_INFRA_STAGE: "aws ecr get-login --registry-ids $ACCOUNT_ID_INFRA_STAGE --region $AWS_REGION_INFRA_STAGE --no-include-email"
#PRODUCTUON
ACCOUNT_ID_INFRA_PROD: 764289642555
AWS_REGION_INFRA_PROD: "us-west-2"
DOCKER_REPO_INFRA_PROD: $ACCOUNT_ID_INFRA_PROD.dkr.ecr.$AWS_REGION_INFRA_PROD.amazonaws.com/$IMAGE_NAME
APP_REPLICAS_INFRA_PROD: "1"
ECRLOGIN_INFRA_PROD: "aws ecr get-login --registry-ids $ACCOUNT_ID_INFRA_PROD --region $AWS_REGION_INFRA_PROD --no-include-email"
Build stage Docker image:
stage: build
tags:
- blox-infra-stage
script:
- docker build -t $IMAGE_NAME:$CI_BUILD_REF -f Dockerfile .
- DOCKER_LOGIN_TO_INFRA_STAGE_REPO=`$ECRLOGIN_INFRA_STAGE`
- docker tag $IMAGE_NAME:$CI_BUILD_REF $DOCKER_REPO_INFRA_STAGE:$CI_BUILD_REF
- $DOCKER_LOGIN_TO_INFRA_STAGE_REPO && docker push $DOCKER_REPO_INFRA_STAGE:$CI_BUILD_REF
only:
- stage
Helm deploy on stage:
stage: deploy
tags:
- blox-infra-stage
image: devth/helm:v3.3.4
script:
- mkdir ~/.kube/
- echo $STAGE_KUBECONFIG | base64 -d > kubeconfig
- mv kubeconfig ~/.kube/
- export KUBECONFIG=~/.kube/kubeconfig
- kubectl config get-contexts
- IMAGE_TAG=$CI_BUILD_REF
- helm upgrade
--install
--namespace validators
--set image.tag=$IMAGE_TAG
--values .k8/helm3/slashing-protector/stage-values.yaml
--wait
slashing-protector
.k8/helm3/slashing-protector/
only:
- stage
#blox-infra-prod
Build prod Docker image:
stage: build
tags:
- blox-infra-prod
script:
- docker build -t $IMAGE_NAME:$CI_BUILD_REF -f Dockerfile .
- DOCKER_LOGIN_TO_INFRA_PROD_REPO=`$ECRLOGIN_INFRA_PROD`
- docker tag $IMAGE_NAME:$CI_BUILD_REF $DOCKER_REPO_INFRA_PROD:$CI_BUILD_REF
- $DOCKER_LOGIN_TO_INFRA_PROD_REPO && docker push $DOCKER_REPO_INFRA_PROD:$CI_BUILD_REF
only:
- main
Helm deploy on production:
stage: deploy
tags:
- blox-infra-prod
image: devth/helm:v3.3.4
script:
- mkdir ~/.kube/
- echo $PROD_KUBECONFIG | base64 -d > kubeconfig
- mv kubeconfig ~/.kube/
- export KUBECONFIG=~/.kube/kubeconfig
- kubectl config get-contexts
- IMAGE_TAG=$CI_BUILD_REF
- helm upgrade
--install
--namespace validators
--set image.tag=$IMAGE_TAG
--values .k8/helm3/slashing-protector/prod-values.yaml
--wait
slashing-protector
.k8/helm3/slashing-protector/
only:
- main