-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
105 lines (94 loc) · 2.24 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
image: node:9-alpine
variables:
KUBE_DOMAIN: flat.k8s.kazik.memleak.pl
stages:
- test
- build
- build-docker
- review
- cleanup
- deploy
- deploy-production
lint:
stage: test
script:
- yarn --cache-folder /cache/yarn_cache install
- yarn run lint
build:
stage: build
script:
- yarn --cache-folder /cache/yarn_cache install
- yarn run build
artifacts:
expire_in: "2 weeks"
paths:
- dist/
build-docker-master:
image: docker:latest
stage: build-docker
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
- docker tag "$CI_REGISTRY_IMAGE" "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
only:
- master
build-docker:
image: docker:latest
stage: build-docker
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except:
- master
deploy-dev:
image: registry.gitlab.memleak.pl:443/flat/flat-api/kubectl
stage: deploy
script:
- command scripts/deployment/deploy
environment:
name: dev
url: http://dev.$KUBE_DOMAIN
only:
- master
deploy-production:
image: registry.gitlab.memleak.pl:443/flat/flat-api/kubectl
stage: deploy-production
script:
- mkdir -p ~/.kube
- echo $KUBE_PROD_CONFIG | base64 -d > ~/.kube/config
- command scripts/deployment/deploy_prod
environment:
name: production
url: https://flat.memleak.pl
when: manual
only:
- master
review:
image: registry.gitlab.memleak.pl:443/flat/flat-api/kubectl
stage: review
script:
- command scripts/deployment/deploy
environment:
name: review/$CI_COMMIT_REF_NAME
url: http://$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN
on_stop: stop_review
only:
- branches
except:
- master
stop_review:
image: registry.gitlab.memleak.pl:443/flat/flat-api/kubectl
stage: cleanup
script:
- command scripts/deployment/destroy
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
when: manual
only:
- branches
except:
- master