From 3d850f6b9a79115ca5db3c5dea0a67882b17e268 Mon Sep 17 00:00:00 2001 From: mtardy Date: Tue, 28 Feb 2023 11:08:32 +0100 Subject: [PATCH 1/2] Clean CVE feed shortcode i18n caption data Previsouly we were using two data items: ```toml [cve_table_date_before] other = "(last updated: " [cve_table_date_after] other = ")" ``` Which was simplified, using printf, to: ```toml [cve_table_date_format_string] other = "(last updated: %s)" ``` This is related to the following discussion https://github.com/kubernetes/website/pull/38579#discussion_r1116992896 --- data/i18n/en/en.toml | 7 ++----- layouts/shortcodes/cve-feed.html | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/data/i18n/en/en.toml b/data/i18n/en/en.toml index ff3a2fc4b030a..b598f8f595eaa 100644 --- a/data/i18n/en/en.toml +++ b/data/i18n/en/en.toml @@ -55,14 +55,11 @@ other = "Issue Summary" [cve_table] other = "Official Kubernetes CVE List" -[cve_table_date_before] -other = "(last updated: " - [cve_table_date_format] other = "02 Jan 2006 15:04:05 MST" -[cve_table_date_after] -other = ")" +[cve_table_date_format_string] +other = "(last updated: %s)" [deprecation_title] other = "You are viewing documentation for Kubernetes version:" diff --git a/layouts/shortcodes/cve-feed.html b/layouts/shortcodes/cve-feed.html index 887999305ab0f..0c5b54671dcec 100644 --- a/layouts/shortcodes/cve-feed.html +++ b/layouts/shortcodes/cve-feed.html @@ -3,7 +3,7 @@ {{ errorf "Build Failed. CVE feed does not comply with JSON feed v1.1" }} {{ end }} - + From aa9f17ed0a83dceefacd2be6347348b9d661052c Mon Sep 17 00:00:00 2001 From: mtardy Date: Tue, 28 Feb 2023 11:14:27 +0100 Subject: [PATCH 2/2] Transform CVE feed shortcode compliance check to warning Previously it would cause the build to fail, which could lead to confusing situation since the CVE feed comes from outside of the website and could break the workflow. See related discussion: https://github.com/kubernetes/website/pull/38579#discussion_r1116996184 --- layouts/shortcodes/cve-feed.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/shortcodes/cve-feed.html b/layouts/shortcodes/cve-feed.html index 0c5b54671dcec..8b829079fba89 100644 --- a/layouts/shortcodes/cve-feed.html +++ b/layouts/shortcodes/cve-feed.html @@ -1,6 +1,6 @@ {{ $feed := getJSON .Site.Params.cveFeedBucket }} {{ if ne $feed.version "https://jsonfeed.org/version/1.1" }} - {{ errorf "Build Failed. CVE feed does not comply with JSON feed v1.1" }} + {{ warnf "CVE feed shortcode. KEP-3203: CVE feed does not comply with JSON feed v1.1." }} {{ end }}
{{ T "cve_table" }} {{ T "cve_table_date_before" }}{{ $feed._kubernetes_io.updated_at | time.Format ( T "cve_table_date_format" ) }}{{ T "cve_table_date_after" }}{{ T "cve_table" }} {{ printf (T "cve_table_date_format_string") ($feed._kubernetes_io.updated_at | time.Format (T "cve_table_date_format")) }}
{{ T "cve_id" }}
{{ T "cve_table" }} {{ printf (T "cve_table_date_format_string") ($feed._kubernetes_io.updated_at | time.Format (T "cve_table_date_format")) }}