-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
54 lines (48 loc) · 1.16 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
stages:
- build
- deploy
.build_image: &build_image
stage: build
image: docker:latest
services:
- docker:dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA --tag $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$TAG .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
- docker push $CI_REGISTRY_IMAGE:$TAG
- docker push $CI_REGISTRY_IMAGE:latest
.deploy_image: &deploy_image
stage: deploy
image: dtzar/helm-kubectl
environment:
name: deploy
script:
- kubectl set image deployment/$K8S_IMAGE $K8S_IMAGE=$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA --record -n zab-web-stack
build dev image:
<<: *build_image
variables:
TAG: dev
only:
- development
- k8s_testing
build prod image:
<<: *build_image
variables:
TAG: master
only:
- master
deploy dev image:
<<: *deploy_image
variables:
K8S_IMAGE: devapi
only:
- development
- k8s_testing
deploy prod image:
<<: *deploy_image
variables:
K8S_IMAGE: api
only:
- master