-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
30 lines (28 loc) · 1.02 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
stages:
- build
- deploy
build:
image: docker
services:
- docker:dind
stage: build
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- docker build -t registry.gitlab.com/dygufa/sengram:v$CI_PIPELINE_ID .
- docker push registry.gitlab.com/dygufa/sengram:v$CI_PIPELINE_ID
deploy:
stage: deploy
only:
- master
image: dtzar/helm-kubectl
script:
- kubectl config set-cluster k8s --server="${SERVER}"
- kubectl config set clusters.k8s.certificate-authority-data ${CERTIFICATE_AUTHORITY_DATA}
- kubectl config set-credentials gitlab --token="${USER_TOKEN}"
- kubectl config set-context default --cluster=k8s --user=gitlab
- kubectl config use-context default
- sed -i "s/\$CI_PIPELINE_ID/${CI_PIPELINE_ID}/g" deploy/app.yml
- sed -i "s/\$TELEGRAM_CHAT_ID/${TELEGRAM_CHAT_ID}/g" deploy/app.yml
- sed -i "s/\$TELEGRAM_BOT_TOKEN/${TELEGRAM_BOT_TOKEN}/g" deploy/app.yml
- cat deploy/*.yml > tmp
- kubectl apply -f tmp