forked from projectcalico/calico
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netlify.toml
275 lines (222 loc) · 7.52 KB
/
netlify.toml
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# Settings in the [build] context are global and are applied to all contexts unless otherwise overridden by more specific contexts.
[build]
publish = "_site/"
command = '''
cp netlify/Gemfile Gemfile && bundle install
make bin/helm
export PATH=$PATH:$(pwd)/bin
# LATEST_RELEASE is set in Netlify UI for environment-variables ONLY for docs.projectcalico.org site.
# Any branch deployed there will have the production ready build that gets deployed at root /
if [ -z "$LATEST_RELEASE" ]; then
# generate only manifests served at /<version>
jekyll build --config _config.yml,$(pwd)/netlify/_config_noindex.yml,$(pwd)/netlify/_manifests_only.yml --baseurl /$RELEASE_VERSION --destination _site/$RELEASE_VERSION
# generate the website which is served at /archive/<version>/
# note: this must be done second since destination folders are cleaned on each builds
jekyll build --config _config.yml,$(pwd)/netlify/_config_noindex.yml --baseurl /archive/$RELEASE_VERSION --destination _site/archive/$RELEASE_VERSION
# move 404 page to root of the site so that netlify shows it automatically
mv _site/archive/$RELEASE_VERSION/404.html _site/404.html
else
# generate the website which is served at root /
jekyll build --config _config.yml,$(pwd)/netlify/_config_latest.yml --destination _site
# generate only manifests served at /<version>
jekyll build --config _config.yml,$(pwd)/netlify/_config_noindex.yml,$(pwd)/netlify/_manifests_only.yml --baseurl /$RELEASE_VERSION --destination _site/$RELEASE_VERSION
# generate the website which is served at /archive/<version>/
jekyll build --config _config.yml,$(pwd)/netlify/_config_noindex.yml --baseurl /archive/$RELEASE_VERSION --destination _site/archive/$RELEASE_VERSION
mv _site/sitemap.xml _site/release-legacy-sitemap.xml
mv _site/sitemap.xml _site/latest-sitemap.xml
mv netlify/sitemap-index.xml _site/sitemap.xml
mv netlify/_redirects _site/_redirects
fi
'''
[build.environment]
RUBY_VERSION = "2.5.4"
RELEASE_VERSION = "master"
[context.deploy-preview]
command = '''
cp netlify/Gemfile Gemfile && bundle install
make bin/helm
export PATH=$PATH:$(pwd)/bin
echo "url: $DEPLOY_PRIME_URL" > _config_url.yml
jekyll build --config _config.yml,_config_url.yml
mv netlify/_redirects _site/_redirects
'''
# Deploys master branch as a seperate individual site, master build is diffrent from branch deploys
# it doesn't have a manifests only build and served without /archive prefix
[context.master]
command = '''
cp netlify/Gemfile Gemfile && bundle install
make bin/helm
export PATH=$PATH:$(pwd)/bin
jekyll build --config _config.yml,$(pwd)/netlify/_config_noindex.yml --baseurl /master --destination _site/master
'''
# proxy redirects for website and manifests for v3.17
[[redirects]]
from = "/archive/v3.17/*"
to = "https://calico-v3-17.netlify.app/archive/v3.17/:splat"
status = 200
[[redirects]]
from = "/v3.17/*"
to = "https://calico-v3-17.netlify.app/v3.17/:splat"
status = 200
# proxy redirects for website and manifests for v3.16
[[redirects]]
from = "/archive/v3.16/*"
to = "https://calico-v3-16.netlify.app/archive/v3.16/:splat"
status = 200
[[redirects]]
from = "/v3.16/*"
to = "https://calico-v3-16.netlify.app/v3.16/:splat"
status = 200
# proxy redirects for website and manifests for v3.15
[[redirects]]
from = "/archive/v3.15/*"
to = "https://calico-v3-15.netlify.app/archive/v3.15/:splat"
status = 200
[[redirects]]
from = "/v3.15/*"
to = "https://calico-v3-15.netlify.app/v3.15/:splat"
status = 200
# proxy redirects for website and manifests for v3.14
[[redirects]]
from = "/archive/v3.14/*"
to = "https://calico-v3-14.netlify.app/archive/v3.14/:splat"
status = 200
[[redirects]]
from = "/v3.14/*"
to = "https://calico-v3-14.netlify.app/v3.14/:splat"
status = 200
# proxy redirects for website and manifests for v3.13
[[redirects]]
from = "/archive/v3.13/*"
to = "https://calico-v3-13.netlify.app/archive/v3.13/:splat"
status = 200
[[redirects]]
from = "/v3.13/*"
to = "https://calico-v3-13.netlify.app/v3.13/:splat"
status = 200
# proxy redirects for website and manifests for v3.12
[[redirects]]
from = "/archive/v3.12/*"
to = "https://calico-v3-12.netlify.app/archive/v3.12/:splat"
status = 200
[[redirects]]
from = "/v3.12/*"
to = "https://calico-v3-12.netlify.app/v3.12/:splat"
status = 200
# proxy redirects for website for master, it doens't need manifests redirect
[[redirects]]
from = "/master/*"
to = "https://calico-master.netlify.app/master/:splat"
status = 200
# site redirects for archive sites, one redirect is sufficient for the entire release legacy site.
[[redirects]]
from = "/archive/*"
to = "https://calico-legacy.netlify.app/archive/:splat"
status = 200
# supporting /<version>/manifests/<manifest.yaml> format for archive sites
# all the redirect rules are nessesarry since the proxy needs to know where to redirect for each path
[[redirects]]
from = "/v3.11/*"
to = "https://calico-legacy.netlify.app/v3.11/:splat"
status = 200
[[redirects]]
from = "/v3.10/*"
to = "https://calico-legacy.netlify.app/v3.10/:splat"
status = 200
[[redirects]]
from = "/v3.9/*"
to = "https://calico-legacy.netlify.app/v3.9/:splat"
status = 200
[[redirects]]
from = "/v3.8/*"
to = "https://calico-legacy.netlify.app/v3.8/:splat"
status = 200
[[redirects]]
from = "/v3.7/*"
to = "https://calico-legacy.netlify.app/v3.7/:splat"
status = 200
[[redirects]]
from = "/v3.6/*"
to = "https://calico-legacy.netlify.app/v3.6/:splat"
status = 200
[[redirects]]
from = "/v3.5/*"
to = "https://calico-legacy.netlify.app/v3.5/:splat"
status = 200
[[redirects]]
from = "/v3.4/*"
to = "https://calico-legacy.netlify.app/v3.4/:splat"
status = 200
[[redirects]]
from = "/v3.3/*"
to = "https://calico-legacy.netlify.app/v3.3/:splat"
status = 200
[[redirects]]
from = "/v3.2/*"
to = "https://calico-legacy.netlify.app/v3.2/:splat"
status = 200
[[redirects]]
from = "/v3.1/*"
to = "https://calico-legacy.netlify.app/v3.1/:splat"
status = 200
[[redirects]]
from = "/v3.0/*"
to = "https://calico-legacy.netlify.app/v3.0/:splat"
status = 200
[[redirects]]
from = "/v2.6/*"
to = "https://calico-legacy.netlify.app/v2.6/:splat"
status = 200
[[redirects]]
from = "/v2.5/*"
to = "https://calico-legacy.netlify.app/v2.5/:splat"
status = 200
[[redirects]]
from = "/v2.4/*"
to = "https://calico-legacy.netlify.app/v2.4/:splat"
status = 200
[[redirects]]
from = "/v2.3/*"
to = "https://calico-legacy.netlify.app/v2.3/:splat"
status = 200
[[redirects]]
from = "/v2.2/*"
to = "https://calico-legacy.netlify.app/v2.2/:splat"
status = 200
[[redirects]]
from = "/v2.1/*"
to = "https://calico-legacy.netlify.app/v2.1/:splat"
status = 200
[[redirects]]
from = "/v2.0/*"
to = "https://calico-legacy.netlify.app/v2.0/:splat"
status = 200
[[redirects]]
from = "/v1.6/*"
to = "https://calico-legacy.netlify.app/v1.6/:splat"
status = 200
[[redirects]]
from = "/v1.5/*"
to = "https://calico-legacy.netlify.app/v1.5/:splat"
status = 200
# shifting generic redirect of /<version> to / from _redirects to toml
[[redirects]]
from = "/latest/*"
to = "/:splat"
status = 301
[[headers]]
for = "/*.yaml"
[headers.values]
content-type = "text/yaml"
[[headers]]
for = "/*.yml"
[headers.values]
content-type = "text/yaml"
[[headers]]
for = "/*.sh"
[headers.values]
content-type = "text/x-shellscript"
[[headers]]
for = "/*.bash"
[headers.values]
content-type = "text/x-shellscript"