-
Notifications
You must be signed in to change notification settings - Fork 38
/
werf.yaml
253 lines (248 loc) · 6.02 KB
/
werf.yaml
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
{{ $_ := set . "CacheVersion" "20230531" }}
configVersion: 1
project: werf-site
---
image: jekyll_base
from: jekyll/builder:4.2.0
fromCacheVersion: {{ $.CacheVersion }}
git:
- add: /
to: /app
owner: jekyll
group: jekyll
includePaths:
- Gemfile
- Gemfile.lock
stageDependencies:
setup: ["**/*"]
shell:
setup:
- cd /app
- bundle install
---
image: common_artifacts
from: ubuntu:20.04
fromCacheVersion: {{ $.CacheVersion }}
ansible:
install:
- file:
path: "/artifacts"
state: directory
mode: 0777
- name: "releases.json"
copy:
content: |
{{ .Files.Get ".werf/artifacts/releases.json" | indent 8 }}
dest: /artifacts/releases.json
- name: "Strip escaping sequence from releases.json"
shell: |
sed -i 's#{% raw %}\ *##; s#{% endraw %}##' /artifacts/releases.json
args:
executable: /bin/bash
warn: false
- name: "releases_history.json"
copy:
content: |
{{ .Files.Get ".werf/artifacts/releases_history.json" | indent 8 }}
dest: /artifacts/releases_history.json
- name: "channels_versions.json"
copy:
content: |
{{ .Files.Get ".werf/artifacts/channels_versions.json" | indent 8 }}
dest: /artifacts/channels_versions.json
- name: "feeds.base64"
copy:
content: |
{{ .Files.Get ".werf/artifacts/feeds.tgz.base64" | indent 8 }}
dest: /artifacts/feeds.tgz.base64
- name: "unpack RSS feeds"
shell: |
if [ -f feeds.tgz.base64 ] ; then base64 -d feeds.tgz.base64 > feeds.tgz; tar -xzf feeds.tgz --transform='s/feeds/./' --wildcards '*.xml'; else echo "RSS feeds file feeds.tgz is absent!"; exit 1 ; fi
rm feeds.tgz.base64
rm feeds.tgz
args:
executable: /bin/bash
warn: false
chdir: /artifacts
---
image: configuration_artifacts
from: golang:1.21
fromCacheVersion: {{ $.CacheVersion }}
git:
- add: /bin/configurator
to: /configurator
stageDependencies:
install: '**/*'
shell:
install:
- cd /configurator
- echo Regenerate configurator pages...
- go run *.go
---
{{- range $lang := list "en" "ru" }}
image: doc_{{ $lang }}
fromImage: jekyll_base
fromCacheVersion: {{ $.CacheVersion }}
import:
- image: common_artifacts
add: /artifacts
to: /artifacts
before: setup
- image: configuration_artifacts
add: /configurator
includePaths:
- static
- generated
to: /tmp
after: install
git:
- add: /
to: /app
owner: jekyll
group: jekyll
includePaths:
- _data
- _includes
- _layouts
- _plugins
- assets
- examples
- pages_{{ $lang }}
- ssi
- _config.yml
- _config_dev.yml
- _config_{{ $lang }}.yml
- "*.xml"
- "*.sh"
- "*.asc"
- "*.png"
- "*.svg"
- favicon.ico
- robots.txt
- site.webmanifest
stageDependencies:
beforeSetup: ["**/*"]
shell:
beforeSetup:
- cp -R /tmp/static/* /tmp/generated/* /app
setup:
- cd /app
- set -u
- mkdir -m 0777 -p /app/_site
- cp -f /artifacts/*.json /app/_data/_common/
- cp -f /artifacts/pages_{{ $lang }}/* /app/pages_{{ $lang }}/
- export JEKYLL_ENV="{{ $.Env }}"
{{- if eq $.Env "development" }}
- bundle exec jekyll build -tV --config _config.yml,_config_dev.yml,_config_{{ $lang }}.yml --destination _site/
{{- else }}
- bundle exec jekyll build --config _config.yml,_config_{{ $lang }}.yml --destination _site/
{{- end }}
---
{{ end -}}
image: backend-artifact
from: golang:1.16
fromCacheVersion: {{ $.CacheVersion }}
ansible:
install:
- name: Build apis
shell: |
go get -d -v ./
go build -ldflags "-w -s" -v -o /go/src/app/server /go/src/app/
args:
executable: /bin/bash
chdir: /go/src/app
git:
- add: /backend
to: /go/src/app
stageDependencies:
install: '**/*'
---
image: backend
from: ubuntu:20.04
fromCacheVersion: {{ $.CacheVersion }}
docker:
WORKDIR: /app
ansible:
install:
- apt:
name: ['git','curl', 'jq', 'vim']
state: present
update_cache: yes
import:
- image: backend-artifact
add: /go/src/app/server
to: /app/server
before: setup
---
image: web-backend
fromImage: backend
fromCacheVersion: {{ $.CacheVersion }}
docker:
WORKDIR: /app
import:
{{- range $lang := list "en" "ru" }}
- image: doc_{{ $lang }}
add: /app/_site
to: /app/root/{{ $lang }}
after: setup
{{ end -}}
---
image: tuf-router
from: fabiocicerchia/nginx-lua:1.21-alpine@sha256:525aa8fd0ac9bf5c7e82cd83b3f8ebf620bedb0d0b1e52955745fd53917eb24c
fromCacheVersion: {{ $.CacheVersion }}
ansible:
install:
- copy:
content: |
{{ .Files.Get ".werf/nginx-tuf-router.conf" | indent 8 }}
dest: /etc/nginx/nginx.conf
- copy:
content: |
{{ .Files.Get ".werf/tuf-router.lua" | indent 8 }}
dest: /etc/nginx/tuf-router.lua
---
{{- if eq $.Env "test" }}
image: spell-checker
from: ubuntu:20.04
fromCacheVersion: {{ $.CacheVersion }}
import:
- image: doc_ru
add: /app/_site
to: /spelling/ru
after: install
- image: doc_en
add: /app/_site
to: /spelling/en
after: install
git:
- add: /scripts/docs/spelling/dictionaries/
to: /temp/dictionaries
stageDependencies:
setup: '**/*'
- add: /scripts/docs/spelling/internal/
to: /temp/internal
stageDependencies:
setup: '**/*'
docker:
ENV:
LANG: ru_RU.UTF-8
LANGUAGE: ru_RU:ru
LC_LANG: ru_RU.UTF-8
LC_ALL: ru_RU.UTF-8
LC_MESSAGES: ru_RU.UTF-8
TZ: Europe/Moscow
shell:
beforeInstall:
- apt -y update && apt -y upgrade
- apt install -y locales
- sed -i -e 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
- ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
install:
- apt -y update && apt -y install hunspell html2text python3.9 python3-pip
- pip3 install beautifulsoup4
setup:
- rm /usr/share/hunspell/*
- cp /temp/dictionaries/* /usr/share/hunspell/
- cp /temp/internal/* /spelling/en
- cp /temp/internal/* /spelling/ru
{{ end -}}