-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
50 lines (37 loc) · 1.41 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
image: docker:latest
services:
- docker:dind
stages:
- build
- deploy
before_script:
- apk --update add git
- git submodule update --init
build:
stage: build
only:
- master
script:
- echo PORT=$PORT >> .env
- echo TOKEN=$TOKEN >> .env
- echo DOCSBOT_SAVE_PATH=$DOCSBOT_SAVE_PATH >> .env
- echo DOCSBOT_ADMIN_ROLE_NAME=$DOCSBOT_ADMIN_ROLE_NAME >> .env
- echo DOCSBOT_LIMIT_CHARS=$DOCSBOT_LIMIT_CHARS >> .env
- docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA" .
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA"
deploy-master:
stage: deploy
image: mateothegreat/docker-alpine-gcloud-kubectl
only:
- master
script:
- kubectl config set-cluster kube-cluster --server="$K8_API_URL" --insecure-skip-tls-verify=true
- kubectl config set-credentials gitlab --token="$K8_TOKEN"
- kubectl config set-context default-context --cluster=kube-cluster --user=gitlab
- kubectl config use-context default-context
- apk --update add git bash curl
- git submodule update --init
- make delete install
- wget https://raw.githubusercontent.com/mateothegreat/gitlab-ci-discord-webhook/master/send.sh
- bash ./send.sh success $DISCORD_WEBHOOK "Deployed to Kubernetes!"