/
.gitlab-ci.yml
110 lines (96 loc) · 2.33 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
106
107
108
109
110
image: ritproject/cli:docker
services:
- docker:dind
variables:
RIT_TUNNEL_RUN: rit --log on_error tunnel --input disabled run apps hcap
GIT_SUBMODULE_STRATEGY: recursive
stages:
- test
- update project images
- update production images
- deploy
before_script:
- rit --log on_error config tunnel add repo https://gitlab.com/pydemic/tunnel --name tunnel
- rit --log on_error config tunnel default set tunnel
# Stage: test
test:
stage: test
variables:
BUILD_TYPE: recursive
script:
- $RIT_TUNNEL_RUN development build
- $RIT_TUNNEL_RUN development test up
- $RIT_TUNNEL_RUN development test sync
- $RIT_TUNNEL_RUN development test all
except:
variables:
- $CI_COMMIT_MESSAGE =~ /--skip-test/
tags:
- docker
# Stage: update project images
.update_project_image: &update_project_image
stage: update project images
script:
- $RIT_TUNNEL_RUN python build
- $RIT_TUNNEL_RUN $IMAGE_TAG build
- docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
- $RIT_TUNNEL_RUN python push
- $RIT_TUNNEL_RUN $IMAGE_TAG push
tags:
- docker
update development project image:
<<: *update_project_image
variables:
IMAGE_TAG: development
only:
- /^development$/
update production project image:
<<: *update_project_image
variables:
IMAGE_TAG: production
only:
- /^production$/
# Stage: update production images
.update_production_image: &update_production_image
stage: update production images
script:
- $RIT_TUNNEL_RUN production build
- docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
- $RIT_TUNNEL_RUN production push
tags:
- docker
update staging image:
<<: *update_production_image
variables:
BUILD_TYPE: recursive
IMAGE_TAG: staging
only:
- /^staging$/
update latest image:
<<: *update_production_image
variables:
BUILD_TYPE: recursive
IMAGE_TAG: latest
only:
- /^latest$/
# Deploy
.deploy: &deploy
stage: deploy
script:
- $RIT_TUNNEL_RUN production deploy up
- $RIT_TUNNEL_RUN production deploy sync
- $RIT_TUNNEL_RUN production deploy playbook
tags:
- docker
deploy staging:
<<: *deploy
environment:
name: staging
only:
- /^staging$/
deploy production:
<<: *deploy
environment:
name: production
only:
- /^latest$/