-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
63 lines (57 loc) · 1.46 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
stages:
- lint
- build
- deploy
workflow:
rules:
- if: $CI_COMMIT_BRANCH =~ /^(master|main)$/
- if: $FORCE_DEPLOY
when: always
- when: never
variables:
IMAGE_NAME: $ci_registry/$CI_PROJECT_PATH
default:
before_script:
- IMAGE_NAME=$(echo $IMAGE_NAME | tr '[:upper:]' '[:lower:]')
lint_helm:
stage: lint
image: matthiasgabathuler/my-runner:ubuntu-20.04
script:
- >-
helm lint ${CI_PROJECT_DIR}/helm
--set image.name=${IMAGE_NAME}
--set image.tag=${CI_COMMIT_REF_NAME}
--set build.job_id=${CI_JOB_ID}
--set build.commit=${CI_COMMIT_SHA}
build_webapp:
stage: build
rules:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- >-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${IMAGE_NAME}-webapp:latest"
deploy_app:
stage: deploy
rules:
image:
name: alpine/helm:3.11.1
entrypoint: [""]
script:
- >-
helm --namespace $k8s_namespace
--kube-context $k8s_context
upgrade $(echo ${CI_PROJECT_NAME} | tr _ -) ${CI_PROJECT_DIR}/helm
--install
--history-max 5
--set image.host=${ci_registry}
--set image.name=${IMAGE_NAME}
--set image.tag=latest
--set build.job_id=${CI_JOB_ID}
--set build.commit=${CI_COMMIT_SHA}
- >-
echo "webapp URL: http://$(echo ${CI_PROJECT_NAME} | tr _ -).course-fwe-2023.isginf.ch"