Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a "releases" page #22736

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions assets/scss/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,23 @@ section#announcement ~ .header-hero {
}
}

/* DOWNLOADS */

.release-table-body {
padding-top: 1.5em;
}
.release-table-body :is(h1, h2, h3, h4, h5, h6):not(:first-child) {
margin-top: 1em;
}

.release-table-body .download-notes > * > code:nth-of-type(2)::after {
content: "\A";
white-space: pre;
}
.release-table-body .download-notes > *:not(:last-child) {
display: none; /* Don't show first release notes paragraph */
}

/* DOCUMENTATION */

/* Don't show lead text */
Expand Down
8 changes: 4 additions & 4 deletions content/en/docs/home/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ cards:
description: Anyone can contribute, whether you're new to the project or you've been around a long time.
button: Contribute to the docs
button_path: /docs/contribute
- name: release-notes
title: K8s Release Notes
- name: download
title: Download Kubernetes
description: If you are installing Kubernetes or upgrading to the newest version, refer to the current release notes.
button: "Download Kubernetes"
button_path: "/docs/setup/release/notes"
button: "View downloads"
button_path: "/docs/setup/release/downloads/"
- name: about
title: About the documentation
description: This website contains documentation for the current and previous 4 versions of Kubernetes.
Expand Down
5 changes: 4 additions & 1 deletion content/en/docs/setup/release/_index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
title: "Release notes and version skew"
layout: releases
title: "Kubernetes Releases"
weight: 10
aliases:
- /releases/
---
5 changes: 5 additions & 0 deletions content/en/docs/setup/release/downloads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
layout: downloads
title: Downloads
weight: 100
---
1,067 changes: 1,067 additions & 0 deletions data/releases/dates.json

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions data/releases/legacy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"name": "v1.0",
"date": "2015-07-10"
},
{
"name": "v1.1",
"date": "2015-11-09"
},
{
"name": "v1.2",
"date": "2016-03-16"
}
]
39 changes: 39 additions & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ other = "Latest version"
[docs_version_other_heading]
other = "Older versions"

[downloads_details]
other = "Details"

[downloads_link_download_page]
other = "Downloads"

[downloads_link_github_release]
other = "Release information"

[downloads_source_code]
other = "Source code"

[downloads_version]
other = "Version"

[error_404_were_you_looking_for]
other = "Were you looking for:"

Expand Down Expand Up @@ -183,6 +198,9 @@ other = "Note:"
[objectives_heading]
other = "Objectives"

[older_releases]
other = "Older Kubernetes releases"

[options_heading]
other = "Options"

Expand All @@ -192,6 +210,27 @@ other = "Create an issue"
[prerequisites_heading]
other = "Before you begin"

[release_download_info_current]
other = "This page lists downloads for {{ .version }}, which is the current minor release."

[release_download_info_previous]
other = "This page lists downloads for {{ .version }}."

[release_download_info_latest]
other = "The latest Kubernetes release is {{ .version }}."

[release_information_latest]
other = "For information on all Kubernetes releases, see the current documentation:"

[release_most_recent]
other = "For Kubernetes {{.minorversion}}, [{{ .version }}](#{{.anchor}}) is the latest patch release."

[release_notes]
other = "Release notes"

[release_list_heading]
other = "List of releases"

[seealso_heading]
other = "See Also"

Expand Down
45 changes: 45 additions & 0 deletions layouts/docs/downloads.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{ define "side-menu" }}
{{ partial "docs/side-menu.html" . }}
{{ end }}

{{ define "main" }}
<div class="td-content">
<h1>{{ .Title }}</h1>
<p>
{{ with (printf "version = \"Kubernetes %s\"" $.Site.Params.version | transform.Unmarshal ) }}
{{- if not $.Site.Params.deprecated }}
{{ T "release_download_info_current" . }}
{{- else }}
{{ T "release_download_info_previous" . }}
{{ with (printf "version = \"Kubernetes %s\"" $.Site.Params.latest | transform.Unmarshal ) }}
{{ T "release_download_info_latest" . }}
{{- end }}
{{- end }}
{{ end }}
</p>
{{ .Content }}
{{ partial "section-index.html" . }}

{{ range last 1 .Site.Data.releases.dates }}
{{ with ( printf "minorversion = \"%s\"\nversion = \"%s\"\nanchor = \"download-%s\"" $.Site.Params.version .name ( replace .name "." "-" ) | transform.Unmarshal ) }}
<p>{{ T "release_most_recent" . | markdownify }}</p>
{{ end }}
{{ end }}
<div class="release-table-header">
<div>{{ T "release_table_header_version" }}</div><div>{{ T "release_table_header_notes" }}</div>
</div>
<div class="release-table-body">
{{ range sort $.Site.Data.releases.dates "date" "desc" }}
{{ if hasPrefix .name $.Site.Params.version }}
<h2 id="download-{{ replace .name "." "-" }}">
{{ .name }}
</h2>
<p class="download-sourcecode"><a href="https://dl.k8s.io/{{ .name }}/kubernetes-src.tar.gz">{{ T "downloads_source_code" }}</a></p>
<div class="download-notes" id="download-{{ replace .name "." "-" }}-notes">
{{ .details | markdownify }}
</div>
{{ end }}
{{ end }}
</div>
</div>
{{ end }}
45 changes: 45 additions & 0 deletions layouts/docs/releases.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{ define "side-menu" }}
{{ partial "docs/side-menu.html" . }}
{{ end }}

{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ partial "section-index.html" . }}
{{- if not $.Site.Params.deprecated }}
<h2 id="release-list">{{ T "release_list_heading" }}</h2>
<details class="release-list">
<summary>{{ T "older_releases" }}</summary>
<ul>
{{ range sort $.Site.Data.releases.legacy "date" "asc"}}
{{ partial "docs/release-info.html" . }}
{{ end }}
{{ range sort $.Site.Data.releases.dates "date" "asc" }}
{{- if strings.HasSuffix .name ".0" }}
{{- if not (hasPrefix .name (printf "%s." $.Site.Params.latest )) }}
{{ partial "docs/release-info.html" . }}
{{- end -}}
{{- end }}
{{ end }}
</ul>
</details>
<hr />
<div id="release-current">
<ul>
{{ range sort $.Site.Data.releases.dates "date" "asc" }}
{{- if strings.HasSuffix .name ".0" }}
{{- if hasPrefix .name (printf "%s." $.Site.Params.latest ) }}
{{ partial "docs/release-info.html" . }}
{{- end -}}
{{- end }}
{{- end }}
</ul>
</div>
{{ else }}
{{ $url := urls.Parse ( printf "%s%s" ( strings.TrimRight "/" $.Site.BaseURL ) ( .Permalink | relURL ) ) }}
{{ with $url }}
<p>{{ T "release_information_latest" }}</p>
<ul id="latest-release-link"><li><a href="{{ . | string }}">{{ $.Site.Params.latest }}</a></li></ul>
{{ end }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions layouts/partials/docs/release-info.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<li datetime="{{ .date }}">
{{ if .details }}
{{ .name | strings.TrimRight "0" | strings.TrimRight ".a" }}
{{ else }}
{{ .name }}
{{ end }}
(<a href="https://relnotes.k8s.io/?releaseVersions={{ trim .name "v" }}" hreflang="en">{{ T "release_notes" }}</a>)
<span class="release-date">{{ dateFormat (site.Params.time_format_blog) (index ( split .date "T" ) 0 | time ) }}</span>.
</li>
29 changes: 29 additions & 0 deletions scripts/update_releases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
# Update release data based on GitHub information

# Test for prerequisites
if ! ( printf "[]" | jq . > /dev/null ); then
printf "jq: not found or misconfigured\n" 1>&2
exit 1
fi
if ! ( curl --version > /dev/null ); then
printf "curl: not found or misconfigured\n" 1>&2
exit 1
fi

page_1_headers="$( curl -I https://api.github.com/repositories/20580498/releases )"

page_count="$( printf "%s" "${page_1_headers}" | grep -i ^link: | cut -d : -f 2- | tr , \\n | grep '; *rel="last"' | grep releases?page= | sed -e 's/^.*?page=//' -e 's/>.*$//' )"

data_file_dates="data/releases/dates.json"

releases_data="$(
seq 1 "${page_count}" | while read count; do
curl -q -L -H 'Accept: application/json' "https://api.github.com/repos/kubernetes/kubernetes/releases?page=${count}" | jq '.[] | select(.name | test("^v[1-9][0-9]*\\.[0-9]+\\.[0-9]+$")) | {"name": .name,"date": .published_at,"details": .body }' || exit 1
sleep 0.1
done | jq -s '. | sort_by(.name | ltrimstr("v") | split(".") | map(. | tonumber)) '
)"

printf "%s\n" "${releases_data}" | tee "$(git rev-parse --show-toplevel)/${data_file_dates}" || exit 1

printf "Release data updated: %s\n" "${data_file_dates}" 1>&2