Skip to content

Commit ff4aad4

Browse files
committed
WIP
Signed-off-by: Ian Maddaus <[email protected]>
1 parent 0b9b64b commit ff4aad4

File tree

3 files changed

+299
-0
lines changed

3 files changed

+299
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ clean_all: clean clean_hugo_mod
2020
serve: bundle
2121
hugo server --buildDrafts --noHTTPCache --buildFuture
2222

23+
serve_production: bundle
24+
hugo server --noHTTPCache --environment production
25+
2326
metrics: bundle
2427
hugo --gc --minify --enableGitInfo --templateMetrics --templateMetricsHints
2528

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
[
2+
"1.0.0",
3+
"1.3.0",
4+
"1.4.1",
5+
"1.5.0",
6+
"1.6.0",
7+
"1.7.1",
8+
"1.14.1",
9+
"1.15.0",
10+
"1.16.1",
11+
"1.17.0",
12+
"1.18.0",
13+
"1.19.0",
14+
"1.19.1",
15+
"1.19.2",
16+
"1.20.0",
17+
"1.21.0",
18+
"1.22.0",
19+
"1.23.0",
20+
"1.24.0",
21+
"1.25.0",
22+
"1.25.1",
23+
"1.26.0",
24+
"1.27.0",
25+
"1.28.0",
26+
"1.28.1",
27+
"1.29.0",
28+
"1.30.0",
29+
"1.31.0",
30+
"1.31.1",
31+
"1.32.1",
32+
"1.33.1",
33+
"1.33.12",
34+
"1.34.1",
35+
"1.35.1",
36+
"1.36.1",
37+
"1.37.6",
38+
"1.38.8",
39+
"1.39.1",
40+
"1.40.0",
41+
"1.41.0",
42+
"1.42.3",
43+
"1.43.5",
44+
"1.43.8",
45+
"1.44.8",
46+
"1.45.9",
47+
"1.45.13",
48+
"1.46.2",
49+
"1.47.0",
50+
"1.48.0",
51+
"1.49.2",
52+
"1.50.1",
53+
"1.51.0",
54+
"1.51.6",
55+
"1.51.15",
56+
"1.51.18",
57+
"1.51.21",
58+
"1.51.25",
59+
"1.51.31",
60+
"2.0.16",
61+
"2.0.17",
62+
"2.0.32",
63+
"2.0.45",
64+
"2.1.0",
65+
"2.1.10",
66+
"2.1.21",
67+
"2.1.30",
68+
"2.1.43",
69+
"2.1.54",
70+
"2.1.59",
71+
"2.1.67",
72+
"2.1.68",
73+
"2.1.72",
74+
"2.1.78",
75+
"2.1.80",
76+
"2.1.81",
77+
"2.1.83",
78+
"2.1.84",
79+
"2.2.10",
80+
"2.2.16",
81+
"2.2.20",
82+
"2.2.27",
83+
"2.2.34",
84+
"2.2.35",
85+
"2.2.41",
86+
"2.2.50",
87+
"2.2.54",
88+
"2.2.55",
89+
"2.2.61",
90+
"2.2.64",
91+
"2.2.70",
92+
"2.2.78",
93+
"2.2.101",
94+
"2.2.102",
95+
"2.2.112",
96+
"2.3.4",
97+
"2.3.5",
98+
"2.3.10",
99+
"2.3.23",
100+
"2.3.24",
101+
"2.3.28",
102+
"3.0.0",
103+
"3.0.9",
104+
"3.0.12",
105+
"3.0.25",
106+
"3.0.46",
107+
"3.0.52",
108+
"3.0.61",
109+
"3.0.64",
110+
"3.1.3",
111+
"3.2.6",
112+
"3.3.14",
113+
"3.4.1",
114+
"3.5.0",
115+
"3.6.2",
116+
"3.6.4",
117+
"3.6.6",
118+
"3.7.1",
119+
"3.7.11",
120+
"3.9.0",
121+
"3.9.3",
122+
"4.3.2",
123+
"4.6.3",
124+
"4.6.4",
125+
"4.6.9",
126+
"4.7.3",
127+
"4.7.18",
128+
"4.7.24",
129+
"4.10.4",
130+
"4.11.3",
131+
"4.12.0",
132+
"4.16.0",
133+
"4.17.6",
134+
"4.17.7",
135+
"4.17.11",
136+
"4.17.14",
137+
"4.17.15",
138+
"4.17.17",
139+
"4.18.0",
140+
"4.18.24",
141+
"4.18.38",
142+
"4.18.39",
143+
"4.18.51",
144+
"4.18.85",
145+
"4.18.97",
146+
"4.18.100",
147+
"4.18.104",
148+
"4.18.108",
149+
"4.18.111",
150+
"4.18.114",
151+
"4.19.0",
152+
"4.19.2",
153+
"4.20.2",
154+
"4.20.6",
155+
"4.20.10",
156+
"4.21.1",
157+
"4.21.3",
158+
"4.22.0",
159+
"4.22.1",
160+
"4.22.8",
161+
"4.22.22",
162+
"4.23.4",
163+
"4.23.10",
164+
"4.23.11",
165+
"4.23.15",
166+
"4.24.8",
167+
"4.24.26",
168+
"4.24.28",
169+
"4.24.32",
170+
"4.25.1",
171+
"4.26.4",
172+
"4.26.13",
173+
"4.28.0",
174+
"4.29.3",
175+
"4.31.0",
176+
"4.31.1",
177+
"4.32.0",
178+
"4.33.1",
179+
"4.36.4",
180+
"4.37.0",
181+
"4.37.8",
182+
"4.37.17",
183+
"4.37.20",
184+
"4.37.23",
185+
"4.37.25",
186+
"4.37.30",
187+
"4.38.3",
188+
"4.38.9",
189+
"4.41.2",
190+
"4.41.20",
191+
"4.46.13",
192+
"4.49.0",
193+
"4.50.3",
194+
"4.52.9",
195+
"4.56.17",
196+
"4.56.19",
197+
"4.56.20",
198+
"4.56.58",
199+
"5.7.9",
200+
"5.10.5",
201+
"5.12.2",
202+
"5.14.0",
203+
"5.17.4",
204+
"5.18.14",
205+
"5.21.29",
206+
"5.22.3",
207+
"5.22.29",
208+
"5.22.36",
209+
"5.22.40",
210+
"5.22.50",
211+
"5.22.55",
212+
"5.22.58",
213+
"5.22.65",
214+
"5.22.72",
215+
"5.22.80",
216+
"5.22.95",
217+
"5.23.6",
218+
"6.6.0",
219+
"6.8.1",
220+
"6.8.11",
221+
"6.8.24",
222+
"7.0.0"
223+
]
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{{- $product := .product -}}
2+
{{- $chefVersions := .chefVersions -}}
3+
4+
{{- $versionsUrl := ""}}
5+
{{- if eq $product "automate" -}}
6+
{{- $versionsUrl = "https://packages.chef.io/releases/current/automate.json" -}}
7+
{{- else if (eq $product "habitat") -}}
8+
{{- $versionsUrl = "/release-notes/habitat/release-versions.json" -}}
9+
{{- else if (eq $product "inspec") -}}
10+
{{- $versionsUrl = "/release-notes/inspec/release-versions.json" -}}
11+
{{- else if (hasPrefix $product "inspec-") -}}
12+
{{- $versionsUrl = print "/release-notes/" $product "/release-dates.json" -}}
13+
{{- else -}}
14+
{{- $versionsUrl = (print "https://omnitruck.chef.io/stable/" $product "/versions/all") -}}
15+
{{- end -}}
16+
17+
{{- $versions := "" -}}
18+
19+
{{- $headers := dict "Cache-Control" "no-cache" "Connection" "keep-alive" -}}
20+
{{- $cacheKey := print $versionsUrl (now.Format "20060102") (now.Hour) | md5 -}}
21+
{{- $opts := dict "headers" $headers "key" $cacheKey -}}
22+
23+
{{- if hasPrefix $versionsUrl "https://" -}}
24+
{{- with try (resources.GetRemote $versionsUrl $opts) -}}
25+
{{- with .Err -}}
26+
{{- errorf "%s" . -}}
27+
{{- else with .Value -}}
28+
{{- $unmarshalOpts := dict "delimiter" "," -}}
29+
{{- $versions = . | transform.Unmarshal $unmarshalOpts -}}
30+
{{- end -}}
31+
{{- else -}}
32+
{{- errorf "Unable to get remote resource %q" $versionsUrl -}}
33+
{{- end -}}
34+
{{- else -}}
35+
{{- with resources.Get $versionsUrl -}}
36+
{{- with . | transform.Unmarshal -}}
37+
{{- $versions = . -}}
38+
{{- end -}}
39+
{{- end -}}
40+
{{- end -}}
41+
42+
{{- if not $versions -}}
43+
{{- errorf "Version data missing from release notes for %s." $product -}}
44+
{{- end -}}
45+
46+
{{/* We have a current version of Infra Client that they want release notes for on the Client release notes page. */}}
47+
{{/* This allows us to add current release version numbers of Client to the list of version numbers */}}
48+
{{/* that we want to include in the Client release notes. */}}
49+
{{- $current_versions := slice -}}
50+
{{- if eq $product "chef" -}}
51+
{{- $versions = append $chefVersions $versions -}}
52+
{{- $paddedVersions := apply $versions "partial" "zero_prefix_pad" "." -}}
53+
{{- $sortedVersions := (sort $paddedVersions "value" "desc") -}}
54+
{{- $versions = apply $sortedVersions "partial" "zero_prefix_trim" "." -}}
55+
{{- end -}}
56+
57+
{{- $versionsCorrectOrder := slice -}}
58+
59+
{{- if eq $product "automate" -}}
60+
{{- $len := len $versions -}}
61+
{{- range seq $len -}}
62+
{{- $versionsCorrectOrder = $versionsCorrectOrder | append (index $versions (sub $len .)) -}}
63+
{{- end -}}
64+
{{- else if eq $product "chef" -}}
65+
{{- $versionsCorrectOrder = $versions -}}
66+
{{- else -}}
67+
{{- $len := len $versions -}}
68+
{{- range seq $len -}}
69+
{{- $versionsCorrectOrder = $versionsCorrectOrder | append (index $versions (sub $len .)) -}}
70+
{{- end -}}
71+
{{- end -}}
72+
73+
{{- return $versionsCorrectOrder -}}

0 commit comments

Comments
 (0)