-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
61 lines (56 loc) · 1.54 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
image: docker:stable
stages:
- build
- deploy
variables:
CLIENT_IMAGE_NAME: $CI_REGISTRY_IMAGE/ricardo-client:$CI_COMMIT_REF_SLUG
API_IMAGE_NAME: $CI_REGISTRY_IMAGE/ricardo-api:$CI_COMMIT_REF_SLUG
DATA_VERSION_REF: "2024.06"
build_client:
stage: build
script:
- docker build -t $CLIENT_IMAGE_NAME --build-arg "STATIC_URL=$BASEURL" --build-arg "DATA_VERSION_REF=$DATA_VERSION_REF" -f ./client/Dockerfile .
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker push $CLIENT_IMAGE_NAME
environment:
name: $CI_COMMIT_REF_SLUG
only:
- master
- staging
- prod
- tags
build_api:
stage: build
script:
- docker build -t $API_IMAGE_NAME --build-arg "DATA_VERSION_REF=$DATA_VERSION_REF" api
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker push $API_IMAGE_NAME
environment:
name: $CI_COMMIT_REF_SLUG
only:
- master
- staging
- prod
- tags
deploy:
image:
name: jrisp/kubehelper:latest
entrypoint: [""]
stage: deploy
dependencies:
- build_client
- build_api
before_script:
- export KUBECONFIG=$kubeconfig_file
script:
- NS=ricardo
- kubectl apply -f k8s/namespace.yml
- cp ${API_SECRETS} k8s/overlays/$CI_COMMIT_REF_SLUG/api.env
- kubectl apply -k k8s/overlays/$CI_COMMIT_REF_SLUG
- kubectl -n ${NS} rollout restart deployment ${NS}-api
- kubectl -n ${NS} rollout restart deployment ${NS}-client
environment:
name: $CI_COMMIT_REF_SLUG
only:
- staging
- prod