From 42d35a549f1c9d72066569fba1bce7d64082d268 Mon Sep 17 00:00:00 2001 From: Jihoon Seo Date: Thu, 22 Apr 2021 18:02:34 +0900 Subject: [PATCH] Fix generating duplicates and omitting heading --- pkg/changelog/const.go | 6 +++--- pkg/notes/document/document.go | 2 +- pkg/notes/document/document_test.go | 2 ++ pkg/notes/document/template.go | 9 +++------ pkg/notes/document/testdata/document.md.golden | 12 +++--------- .../testdata/document_without_downloads.md.golden | 5 ----- 6 files changed, 12 insertions(+), 24 deletions(-) diff --git a/pkg/changelog/const.go b/pkg/changelog/const.go index c901f6e24c9..70bcb2daa2e 100644 --- a/pkg/changelog/const.go +++ b/pkg/changelog/const.go @@ -41,7 +41,7 @@ filename | sha512 hash {{end}} {{- with .Downloads.Client -}} -### Client binaries +### Client Binaries filename | sha512 hash -------- | ----------- @@ -49,7 +49,7 @@ filename | sha512 hash {{end}} {{- with .Downloads.Server -}} -### Server binaries +### Server Binaries filename | sha512 hash -------- | ----------- @@ -57,7 +57,7 @@ filename | sha512 hash {{end}} {{- with .Downloads.Node -}} -### Node binaries +### Node Binaries filename | sha512 hash -------- | ----------- diff --git a/pkg/notes/document/document.go b/pkg/notes/document/document.go index fc3bf6d460a..1c792442bb2 100644 --- a/pkg/notes/document/document.go +++ b/pkg/notes/document/document.go @@ -379,7 +379,7 @@ func CreateDownloadsTable(w io.Writer, bucket, tars, prevTag, newTag string) err // Sort the files by their headers headers := [4]string{ - "", "Client Binaries", "Server Binaries", "Node Binaries", + "Source Code", "Client Binaries", "Server Binaries", "Node Binaries", } files := map[string][]File{ headers[0]: fileMetadata.Source, diff --git a/pkg/notes/document/document_test.go b/pkg/notes/document/document_test.go index ba95617c839..b10916831ad 100644 --- a/pkg/notes/document/document_test.go +++ b/pkg/notes/document/document_test.go @@ -175,6 +175,8 @@ func TestCreateDownloadsTable(t *testing.T) { ## Downloads for v1.16.1 +### Source Code + filename | sha512 hash -------- | ----------- [kubernetes.tar.gz](https://dl.k8s.io/v1.16.1/kubernetes.tar.gz) | `+"`"+`27864cc5219a951a7a6e52b8c8dddf6981d098da1658d96258c870b2c88dfbcb51841aea172a28bafa6a79731165584677066045c959ed0f9929688d04defc29`+"`"+` diff --git a/pkg/notes/document/template.go b/pkg/notes/document/template.go index fe305374bcd..62a6ba5d0f3 100644 --- a/pkg/notes/document/template.go +++ b/pkg/notes/document/template.go @@ -22,9 +22,7 @@ package document const defaultReleaseNotesTemplate = ` {{- $CurrentRevision := .CurrentRevision -}} {{- $PreviousRevision := .PreviousRevision -}} -# Release notes for {{$CurrentRevision}} -[Documentation](https://docs.k8s.io/docs/home) {{if .Downloads}} ## Downloads for {{$CurrentRevision}} @@ -38,7 +36,7 @@ filename | sha512 hash {{end}} {{- with .Downloads.Client -}} -### Client binaries +### Client Binaries filename | sha512 hash -------- | ----------- @@ -46,7 +44,7 @@ filename | sha512 hash {{end}} {{- with .Downloads.Server -}} -### Server binaries +### Server Binaries filename | sha512 hash -------- | ----------- @@ -54,14 +52,13 @@ filename | sha512 hash {{end}} {{- with .Downloads.Node -}} -### Node binaries +### Node Binaries filename | sha512 hash -------- | ----------- {{range .}}[{{.Name}}]({{.URL}}) | {{.Checksum}}{{println}}{{end}} {{end -}} {{- end -}} -# Changelog since {{$PreviousRevision}} {{with .CVEList -}} ## Important Security Information diff --git a/pkg/notes/document/testdata/document.md.golden b/pkg/notes/document/testdata/document.md.golden index bb22cc06ef1..f797c664ba6 100644 --- a/pkg/notes/document/testdata/document.md.golden +++ b/pkg/notes/document/testdata/document.md.golden @@ -1,7 +1,3 @@ -# Release notes for v1.16.1 - -[Documentation](https://docs.k8s.io/docs/home) - ## Downloads for v1.16.1 ### Source Code @@ -11,7 +7,7 @@ filename | sha512 hash [kubernetes.tar.gz](https://dl.k8s.io/v1.16.1/kubernetes.tar.gz) | 27864cc5219a951a7a6e52b8c8dddf6981d098da1658d96258c870b2c88dfbcb51841aea172a28bafa6a79731165584677066045c959ed0f9929688d04defc29 [kubernetes-src.tar.gz](https://dl.k8s.io/v1.16.1/kubernetes-src.tar.gz) | 27864cc5219a951a7a6e52b8c8dddf6981d098da1658d96258c870b2c88dfbcb51841aea172a28bafa6a79731165584677066045c959ed0f9929688d04defc29 -### Client binaries +### Client Binaries filename | sha512 hash -------- | ----------- @@ -26,7 +22,7 @@ filename | sha512 hash [kubernetes-client-windows-386.tar.gz](https://dl.k8s.io/v1.16.1/kubernetes-client-windows-386.tar.gz) | 27864cc5219a951a7a6e52b8c8dddf6981d098da1658d96258c870b2c88dfbcb51841aea172a28bafa6a79731165584677066045c959ed0f9929688d04defc29 [kubernetes-client-windows-amd64.tar.gz](https://dl.k8s.io/v1.16.1/kubernetes-client-windows-amd64.tar.gz) | 27864cc5219a951a7a6e52b8c8dddf6981d098da1658d96258c870b2c88dfbcb51841aea172a28bafa6a79731165584677066045c959ed0f9929688d04defc29 -### Server binaries +### Server Binaries filename | sha512 hash -------- | ----------- @@ -36,7 +32,7 @@ filename | sha512 hash [kubernetes-server-linux-ppc64le.tar.gz](https://dl.k8s.io/v1.16.1/kubernetes-server-linux-ppc64le.tar.gz) | 27864cc5219a951a7a6e52b8c8dddf6981d098da1658d96258c870b2c88dfbcb51841aea172a28bafa6a79731165584677066045c959ed0f9929688d04defc29 [kubernetes-server-linux-s390x.tar.gz](https://dl.k8s.io/v1.16.1/kubernetes-server-linux-s390x.tar.gz) | 27864cc5219a951a7a6e52b8c8dddf6981d098da1658d96258c870b2c88dfbcb51841aea172a28bafa6a79731165584677066045c959ed0f9929688d04defc29 -### Node binaries +### Node Binaries filename | sha512 hash -------- | ----------- @@ -47,8 +43,6 @@ filename | sha512 hash [kubernetes-node-linux-s390x.tar.gz](https://dl.k8s.io/v1.16.1/kubernetes-node-linux-s390x.tar.gz) | 27864cc5219a951a7a6e52b8c8dddf6981d098da1658d96258c870b2c88dfbcb51841aea172a28bafa6a79731165584677066045c959ed0f9929688d04defc29 [kubernetes-node-windows-amd64.tar.gz](https://dl.k8s.io/v1.16.1/kubernetes-node-windows-amd64.tar.gz) | 27864cc5219a951a7a6e52b8c8dddf6981d098da1658d96258c870b2c88dfbcb51841aea172a28bafa6a79731165584677066045c959ed0f9929688d04defc29 -# Changelog since v1.16.0 - ## Urgent Upgrade Notes ### (No, really, you MUST read this before you upgrade) diff --git a/pkg/notes/document/testdata/document_without_downloads.md.golden b/pkg/notes/document/testdata/document_without_downloads.md.golden index fcda0ac0fb9..58f93128178 100644 --- a/pkg/notes/document/testdata/document_without_downloads.md.golden +++ b/pkg/notes/document/testdata/document_without_downloads.md.golden @@ -1,8 +1,3 @@ -# Release notes for v1.16.1 - -[Documentation](https://docs.k8s.io/docs/home) -# Changelog since v1.16.0 - ## Urgent Upgrade Notes ### (No, really, you MUST read this before you upgrade)