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

[DO NOT MERGE] Test support warning (re. assistance-only support and EOL) future states #18615

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
3 changes: 1 addition & 2 deletions src/current/_includes/sidebar-data-v23.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
]
},
{% include_cached v23.1/sidebar-data/get-started.json %},
{% include_cached v23.1/sidebar-data/latest-releases.json %},
{% include_cached v23.1/sidebar-data/releases.json %},
{% include_cached v23.1/sidebar-data/feature-overview.json %},
{% include_cached v23.1/sidebar-data/connect-to-cockroachdb.json %},
{% include_cached v23.1/sidebar-data/migrate.json %},
Expand All @@ -22,6 +22,5 @@
{% include_cached v23.1/sidebar-data/sql.json %},
{% include_cached v23.1/sidebar-data/reference.json %},
{% include_cached v23.1/sidebar-data/faqs.json %},
{% include_cached v23.1/sidebar-data/releases.json %},
{% include_cached sidebar-data-cockroach-university.json %}
]
52 changes: 42 additions & 10 deletions src/current/_includes/unsupported-version.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
{% assign DEBUG=false %}
{% unless include.major_version %}
Missing include.major_version. Usage: <code>{% raw %}{% include unsupported-version.md major_version=page.major_version %}{% endraw %}</code>
{% break %}
{% endunless %}

{% assign today = "today" | date: "%s" %} {% comment %} Fetch today's date and format it in seconds. {% endcomment %}
{% comment %} Some dates to test:

2025-11-14: 23.1 LTS EOL (LTS EOL message)
2025-11-13: 23.1 LTS Assistance (LTS Assistance message)
2024-11-13: 23.1 LTS Maintenance (LTS Assistance message)
2024-11-12: 23.1 LTS GA (no message)
{% endcomment %}

{% comment %}Uncomment the following two lines and comment the third to test a specific date{% endcomment %}
{% assign today = '2024-11-12' | date: "%s" %}{% comment %} Simulate future date and format it in seconds. {% endcomment %}
{% assign actual_today = "today" | date: "%s" %} {% comment %} Fetch today's date and format it in seconds. {% endcomment %}
{% comment %}{% assign today = "today" | date: "%s" %}{% endcomment %} {% comment %} Fetch today's date and format it in seconds. {% endcomment %}

{% if DEBUG %}
Actual today: {{ actual_today }}<br />
Today: {{ today }}<br />
{% endif %}

{% assign x = site.data.versions | where_exp: "m", "m.major_version == include.major_version" | first %}

Expand Down Expand Up @@ -35,36 +52,51 @@ Missing include.major_version. Usage: <code>{% raw %}{% include unsupported-vers
{% comment %}Continue only if we found an entry for this major version {% endcomment %}
{% if x %}

{% assign lts = false %}
{% comment %}Is it an LTS?{% endcomment %}
{% if x.initial_lts_patch != "N/A" %}
{% assign lts = true %}
{% assign lm = x.lts_maint_supp_exp_date | date: "%s" %} {% comment %} Format m_raw in seconds. {% endcomment %}
{% assign la = x.lts_asst_supp_exp_date | date: "%s" %} {% comment %} Format a_raw in seconds. {% endcomment %}
{% endif %}

{% assign production = false %}
{% assign lts = false %}
{% comment %}Is it GA?{% endcomment %}
{% if x.asst_supp_exp_date != "N/A" and x.asst_supp_exp_date != "N/A" %}
{% assign production = true %}
{% assign m = x.maint_supp_exp_date | date: "%s" %} {% comment %} Format m_raw in seconds. {% endcomment %}
{% assign a = x.asst_supp_exp_date | date: "%s" %} {% comment %} Format a_raw in seconds. {% endcomment %}
{% endif %}

{% if production == true %}
{% comment %}Is it an LTS?{% endcomment %}
{% if x.initial_lts_patch != "N/A" %}
{% assign lts = true %}
{% assign lm = x.lts_maint_supp_exp_date | date: "%s" %} {% comment %} Format m_raw in seconds. {% endcomment %}
{% assign la = x.lts_asst_supp_exp_date | date: "%s" %} {% comment %} Format a_raw in seconds. {% endcomment %}
{% endif %}
{% endif %}

{% comment %}Show unsupported admonitions only for production releases {% endcomment %}
{% if production == true %}
{% comment %}Show LTS admonitions only for versions with LTS releases {% endcomment %}
{% if lts == true %}

{% if DEBUG %}
lts: {{ lts }}<br />
production: {{ production }}<br />
lm: {{ lm }}<br />
la: {{ la }}<br />
m: {{ m }}<br />
a: {{ a }}<br />
{% endif %}
{% if la < today %} {% comment %}LTS assistance has passed, EOL{% endcomment %}
{{ lts_eol_message }}
{% elsif lm < today %} {% comment %}LTS maintenance has passed, in LTS assistance{% endcomment %}
{% elsif lm <= today %} {% comment %}LTS maintenance has passed, in LTS assistance{% endcomment %}
{{ lts_assistance_message }}
{% endif %}

{% comment %}Show non-LTS admonitions only releases without LTS {% endcomment %}
{% else %}

{% if DEBUG %}
production: {{ production }}<br />
m: {{ m }}<br />
a: {{ a }}<br />
{% endif %}
{% if a < today %} {% comment %}assistance has passed, EOL{% endcomment %}
{{ ga_eol_message }}
{% elsif m < today %} {% comment %}maintenance has passed{% endcomment %}
Expand Down
7 changes: 0 additions & 7 deletions src/current/_includes/v23.1/sidebar-data/latest-releases.json

This file was deleted.

10 changes: 7 additions & 3 deletions src/current/_layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ <h1 class="post-title-main w-100">{{ page.title }}</h1>
</div>
<div id="toc" class="d-none"></div>
{% endif %}
{% if page.major_version %}{% comment %}Show unsupported version details only if a page is versioned{% endcomment %}
{% capture majorversion %}{{ page.major_version }}{% endcapture %}
{% include unsupported-version.md major_version=majorversion %}
{% assign majorversion = 0 %}
{% if page.version.version %}
{% assign majorversion = page.version.version %}
{% elsif page.major_version %}
{% assign majorversion = page.major_version %}
{% endif %}
{% if majorversion %}{% include unsupported-version.md major_version=majorversion %}{% endif %}

{{content}}

{% if page.feedback != false %}
Expand Down
Loading