-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
133 lines (125 loc) · 3.42 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
stages:
- build_base
- build_dev
- build_prod
- deploy_dev
- deploy_prod
- release
build_backend_base:
stage: build_base
image: docker
script:
- docker login ${CI_REGISTRY} -u gitlab-ci-token -p ${CI_BUILD_TOKEN}
- docker build -t ${CI_REGISTRY_IMAGE}:backend-base -f ./backend/Dockerfile.base ./backend
- docker push ${CI_REGISTRY_IMAGE}:backend-base
only:
refs:
- dev
changes:
- backend/Dockerfile.base
- .gitlab-ci.yml
tags:
- ns01
build_frontend_dev:
stage: build_dev
image: docker
script:
- docker login ${CI_REGISTRY} -u gitlab-ci-token -p ${CI_BUILD_TOKEN}
- docker build -t ${CI_REGISTRY_IMAGE}:frontend-dev -f ./frontend/.docker/Dockerfile ./frontend
- docker push ${CI_REGISTRY_IMAGE}:frontend-dev
only:
refs:
- dev
changes:
- frontend/**/*
- .gitlab-ci.yml
tags:
- ns01
build_backend_dev:
stage: build_dev
image: docker
script:
- docker login ${CI_REGISTRY} -u gitlab-ci-token -p ${CI_BUILD_TOKEN}
- docker build -t ${CI_REGISTRY_IMAGE}:backend-dev ./backend
- docker push ${CI_REGISTRY_IMAGE}:backend-dev
only:
refs:
- dev
changes:
- backend/**/*
- .gitlab-ci.yml
tags:
- ns01
build_frontend_prod:
stage: build_prod
image: docker
script:
- docker login ${CI_REGISTRY} -u gitlab-ci-token -p ${CI_BUILD_TOKEN}
- docker build -t ${CI_REGISTRY_IMAGE}:frontend-prod -f ./frontend/.docker/Dockerfile ./frontend
- docker push ${CI_REGISTRY_IMAGE}:frontend-prod
only:
refs:
- master
changes:
- frontend/**/*
- .gitlab-ci.yml
tags:
- ns01
build_backend_prod:
stage: build_prod
image: docker
script:
- docker login ${CI_REGISTRY} -u gitlab-ci-token -p ${CI_BUILD_TOKEN}
- docker build -t ${CI_REGISTRY_IMAGE}:backend-prod ./backend
- docker push ${CI_REGISTRY_IMAGE}:backend-prod
only:
refs:
- master
changes:
- backend/**/*
- .gitlab-ci.yml
tags:
- ns01
deploy_dev:
stage: deploy_dev
image: cytopia/ansible:2.8-infra
script:
- git clone https://${GL_USER}:${GL_TOKEN}@gitlab.com/natural-solutions/ns-ansible-infrastructure.git
- cd ns-ansible-infrastructure
- echo ${VAULT_PASSWORD_KEY} > password-file
- ansible-vault decrypt --vault-password-file password-file k
- ansible-playbook -i hosts -l ecoteka_dev --vault-password-file password-file deploy.yml
- rm password-file
only:
- dev
tags:
- ns01
variables:
ANSIBLE_HOST_KEY_CHECKING: "false"
ANSIBLE_INVENTORY_UNPARSED_FAILED: "true"
deploy_prod:
stage: deploy_prod
image: cytopia/ansible:2.8-infra
script:
- git clone https://${GL_USER}:${GL_TOKEN}@gitlab.com/natural-solutions/ns-ansible-infrastructure.git
- cd ns-ansible-infrastructure
- echo ${VAULT_PASSWORD_KEY} > password-file
- ansible-vault decrypt --vault-password-file password-file k
- ansible-playbook -i hosts -l ecoteka_prod --vault-password-file password-file deploy.yml
- rm password-file
only:
- master
tags:
- ns01
variables:
ANSIBLE_HOST_KEY_CHECKING: "false"
ANSIBLE_INVENTORY_UNPARSED_FAILED: "true"
release:
stage: release
script:
- npm i @semantic-release/gitlab @semantic-release/git @semantic-release/changelog @semantic-release/exec @semantic-release/release-notes-generator @semantic-release/commit-analyzer
- npx semantic-release
only:
- master
tags:
- ns01