This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
forked from antoine-de/mimirsbrunn
-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
190 lines (173 loc) · 4.42 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
stages:
- lint
- test
- build
- development
- integration
- production
.lint:
stage: lint
image: rust:1.60
variables:
CARGO_HOME: "$CI_PROJECT_DIR/.cargo"
GIT_SUBMODULE_STRATEGY: recursive
cache:
key: $CI_PROJECT_NAME-$CI_JOB_STAGE
paths:
- .cargo
- target/
tags:
- k8s
format:
extends: .lint
before_script:
- source ci/bootstrap.sh
- rustup component add rustfmt
script:
- make format
lint:
extends: .lint
before_script:
- source ci/bootstrap.sh
- rustup component add clippy
script:
- make lint
test:
stage: test
image: rust:1.60
services:
- name: "docker.elastic.co/elasticsearch/elasticsearch:7.13.0"
alias: "elasticsearch"
command: ["bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node"]
variables:
CARGO_HOME: "$CI_PROJECT_DIR/.cargo"
GIT_SUBMODULE_STRATEGY: recursive
CARGO_BUILD_JOBS: 8
MIMIR_TEST_DOCKER__ENABLE: 'false'
MIMIR_TEST_ELASTICSEARCH__URL: 'http://elasticsearch:9200'
KUBERNETES_MEMORY_LIMIT: 12Gi
KUBERNETES_MEMORY_REQUEST: 4Gi
before_script:
- source ci/bootstrap.sh
script:
- make test
cache:
key: $CI_PROJECT_NAME-$CI_JOB_STAGE
paths:
- .cargo
- target/
tags:
- k8s
.build:
stage: build
before_script:
- source ci/bootstrap.sh
- docker login
--username "$CI_REGISTRY_USER"
--password-stdin "$CI_REGISTRY" <<< "$CI_REGISTRY_PASSWORD"
variables:
COMPOSE_DOCKER_CLI_BUILD: "1"
COMPOSE_FILE: "ci/docker-compose.build.yml"
DOCKER_BUILDKIT: "1"
DOCKER_CONFIG: "$CI_PROJECT_DIR/.docker"
GIT_SUBMODULE_STRATEGY: recursive
IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
artifacts:
paths:
- "ci/"
tags:
- light
build bragi:
extends: .build
variables:
DOCKER_CONFIG: "$CI_PROJECT_DIR/bragi/.docker"
script:
- docker-compose build bragi
- docker-compose push bragi
build mimirsbrunn:
extends: .build
variables:
DOCKER_CONFIG: "$CI_PROJECT_DIR/mimirsbrunn/.docker"
script:
- docker-compose build mimirsbrunn
- docker-compose push mimirsbrunn
.deploy:
image: registry.qwant.ninja/docker/kubectl:1.19.1
variables:
ARGOAPP_REPO_BASEDIR: "deployments"
ARGOAPP_REPO_URL_SSH: "[email protected]:teams/search-apps/argo_apps.git"
ARGOCD_APP_ENVIRONMENT: "$CI_ENVIRONMENT_NAME"
ARGOCD_SERVER: "${ARGOCD_SERVER_C2}"
ARGOCD_AUTH_TOKEN: "${ARGOCD_AUTH_TOKEN_C2}"
ARGOCD_OPTS: "--insecure"
before_script:
- source ci/bootstrap.sh
when: manual
tags:
- docker
.deploy:mimir:
extends: .deploy
variables:
ARGOAPP_REPO_PATH: "maps/mimirsbrunn"
ARGOAPP_REPO_BRANCH: "master"
ARGOCD_APP_NAME: "mimirsbrunn-${CI_JOB_STAGE}"
IMAGE_VERSION_FILE: "overlays/${CI_JOB_STAGE}/kustomization.yaml"
resource_group: "mimir-$CI_JOB_STAGE"
script:
- sync-version-argocd
--docker-image "$CI_COMMIT_SHORT_SHA"
--image-version-object-path "(.images[] | select(.name == \"$CI_REGISTRY_IMAGE/mimir\") | .newTag)"
- argocd app sync ${ARGOCD_APP_NAME} --async
- argocd app wait ${ARGOCD_APP_NAME} --health --sync --timeout 180
.deploy:bragi:
extends: .deploy
variables:
ARGOAPP_REPO_PATH: "maps/bragi"
ARGOAPP_REPO_BRANCH: "master"
ARGOCD_APP_NAME: "bragi-${CI_JOB_STAGE}"
IMAGE_VERSION_FILE: "versions/${CI_JOB_STAGE}.yaml"
resource_group: "bragi-$CI_JOB_STAGE"
before_script:
- source ci/bootstrap.sh
script:
- sync-version-argocd
--docker-image "$CI_REGISTRY_IMAGE/bragi:$CI_COMMIT_SHORT_SHA"
--image-version-object-path ".image"
- argocd app sync ${ARGOCD_APP_NAME} --async
- argocd app wait ${ARGOCD_APP_NAME} --health --sync --timeout 180
#
# Deploy Mimir docker image
#
deploy mimir development:
stage: development
extends:
- .deploy:mimir
deploy mimir integration:
stage: integration
extends:
- .deploy:mimir
deploy mimir production:
stage: production
variables:
ARGOCD_SERVER: "${ARGOCD_SERVER_C4}"
ARGOCD_AUTH_TOKEN: "${ARGOCD_AUTH_TOKEN_C4}"
extends:
- .deploy:mimir
#
# Deploy Bragi docker image
#
deploy bragi development:
stage: development
extends:
- .deploy:bragi
deploy bragi integration:
stage: integration
extends:
- .deploy:bragi
deploy bragi production:
stage: production
variables:
ARGOCD_SERVER: "${ARGOCD_SERVER_C4}"
ARGOCD_AUTH_TOKEN: "${ARGOCD_AUTH_TOKEN_C4}"
extends:
- .deploy:bragi