This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
139 lines (126 loc) · 3.27 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
132
133
134
135
136
137
138
139
stages:
- build
- deploy
- check-deployment
default:
tags:
- ${ENVIRONMENT}-runner
include:
- file: /build-image/template.yml
project: capstan/pow/gitlab-templates
ref: build-image-v3
- file: /render-charts/template.yml
project: capstan/pow/gitlab-templates
ref: render-charts-v3
- file: /run-argo-deployer/template.yml
project: capstan/pow/gitlab-templates
ref: run-argo-deployer-v3
- project: capstan/pow/gitlab-templates
file: argocd-sync/template.yml
ref: argocd-sync-v3
- project: capstan/pow/gitlab-templates
file: check-healthy-deployment/template.yml
ref: check-healthy-deployment-v3
# Variables that are defined in the project: AIW_ART_PATH, AIW_HELM_CHART, AIW_NPM_REGISTRY
variables:
APP_NAME: artstor-ui
APP_SERVICE_NAME: artstor-ui
EUREKA_SERVICE_NAME: artstor-ui
PIPELINE:
description: "Select pipeline"
value: "Select pipeline"
options:
- "Select pipeline"
- "deploy"
ENVIRONMENT:
description: "Choose environment"
value: "test"
options:
- "test"
- "prod"
APP_IMAGE: $DOCKER_VIRTUAL/$CI_PROJECT_PATH:$CI_COMMIT_SHORT_SHA
HELM_CHART_PATH: "$AIW_HELM_CHART"
MANIFEST_OUTPUT_DIRECTORY: $CI_PROJECT_DIR/manifests
build-app:
stage: build
image: $DOCKER_VIRTUAL/node:11.0.0
script:
- printenv | sort
- yarn config set npmRegistryServer $AIW_NPM_REGISTRY
- yarn install
- yarn build:ssr:$ENVIRONMENT
rules:
- if: $PIPELINE == "deploy"
when: always
artifacts:
paths:
- $CI_PROJECT_DIR/dist/
build-image:
stage: build
extends: .build-image
needs:
- job: build-app
artifacts: true
rules:
- if: $PIPELINE == "deploy"
when: on_success
variables:
CONTEXT: .
DOCKERFILE: Dockerfile
IMAGE_TAG: $APP_IMAGE
EXTRA_ARGS: --build-arg SAGOKU_ENV=$ENVIRONMENT
render-charts:
stage: build
extends: .render-charts
rules:
- if: $PIPELINE == "deploy" && $ENVIRONMENT == "prod"
when: always
variables:
EXTRA_HELM_TEMPLATE_OPTIONS: -f $CI_PROJECT_DIR/k8s/values_prod.yaml
- if: $PIPELINE == "deploy" && $ENVIRONMENT == "test"
when: always
variables:
EXTRA_HELM_TEMPLATE_OPTIONS: -f $CI_PROJECT_DIR/k8s/values_test.yaml
deploy:
stage: deploy
extends: .run-argo-deployer
rules:
- if: $PIPELINE == "deploy" && $ENVIRONMENT == "prod"
when: on_success
variables:
ENVIRONMENT_URL: https://library.artstor.org/
- if: $PIPELINE == "deploy" && $ENVIRONMENT == "test"
when: on_success
variables:
ENVIRONMENT_URL: https://stage.artstor.org/
environment:
name: $ENVIRONMENT
url: ENVIRONMENT_URL
variables:
ACTION: deploy
APP_NAME: artstor-ui
GROUP_NAME: $ITHAKA_OWNER
INPUT_FILES_LOCATION: manifests
argo-sync:
stage: deploy
extends: .argocd-sync
needs:
- deploy
rules:
- if: $PIPELINE == "deploy"
when: on_success
variables:
APP_NAME: artstor-ui
check-healthy-deployment:
stage: check-deployment
extends: .check-healthy-deployment
rules:
- !reference [argo-sync, rules]
variables:
APP_TYPE: "nodejs"
HEALTHCHECK_MAX_ITER: 200 # number of times to check
HEALTHCHECK_MAX_WAIT: 5 # in seconds
inherit:
variables: true
retry: 1
timeout: 30 minutes