-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
53 lines (48 loc) · 1.53 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
stages:
- test
- docker
- deploy
variables:
KUBECONFIG: .kube/config
cache: &global_cache
key: $CI_PROJECT_NAME
paths:
- node_modules/
policy: pull-push
unit_testing:
image: node:18.16.1
stage: test
cache:
<<: *global_cache
retry: 2
script:
- yarn install --frozen-lockfile --check-files --cache-folder .yarn --prefer-offline
- yarn lint
- yarn install --frozen-lockfile --check-files --cache-folder .yarn --prefer-offline --production
docker_image_build_release:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: docker
cache:
<<: *global_cache
policy: pull
retry: 2
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --destination $CI_REGISTRY_IMAGE:latest
deploy:
image:
name: bitnami/kubectl@sha256:6410882b254fde82200c364b606b0cbb9b0fb802fede69011a33b9d28066b459 #1.25.9
entrypoint: [""]
cache: []
stage: deploy
retry: 2
before_script:
- sed -ie "s/deploy-date-value/$(date)/g" kubernetes/deployment.yaml
- sed -ie "s|registry-value|$CI_REGISTRY_IMAGE|g" kubernetes/deployment.yaml
- mkdir -p .kube/ && touch .kube/config
- echo ${KUBERNETES_EXTERNAL_CLUSTER} | base64 -d -i > ${KUBECONFIG}
script:
- kubectl apply -f kubernetes/deployment.yaml