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

[sort] Sort products manually and remove sortReleasesBy #1651

Merged
merged 6 commits into from
Oct 8, 2022
Merged
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
14 changes: 1 addition & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,9 @@ layout: post
# server-app are applications usually installed on the server-side
category: os

# What should be used to sort releases. Set to one of:
# releaseCycle/eol/support/releaseDate/cycleShortHand/latest/latestShortHand
# which must be present in all of the releases underneath
sortReleasesBy: "releaseCycle"

# Template to be used to generate a link for the release
# __RELEASE_CYCLE__ will be replaced by the value of releaseCycle
# __CYCLE_SHORT_HAND__ will be replaced by the optional changelogTemplate
# __LATEST__ will be replaced by the value of latest
# __LATEST_SHORT_HAND__ will be replaced by the optional latestShortHand
# __CODENAME__ will be replaced by the optional codename

# You can even use Liquid Templating inside the template, such as:
Expand Down Expand Up @@ -140,6 +133,7 @@ releases:
releaseLabel: "Timeturner Firebolt (1.2)"
# End of Security Support for the product. Alternatively, set to true|false if EOL is not pre-decided
# In case there is extended/commercial support available, pick the date that would apply to the majority of users.
# Use valid dates, and do not add quotes around dates.
eol: 2019-01-01
# End of Active Support for the product. This is where bugfixes usually stop coming in. (remove if activeSupportColumn=false)
# Alternatively, set to true|false if it is not pre-decided
Expand All @@ -160,12 +154,6 @@ releases:
lts: true
# Can be true/false. Only use if discontinuedColumn is set to true
discontinued: true
# Optional, can be used to sort releases, and as part of the changelogTemplate (__LATEST_SHORT_HAND__).
latestShortHand: "10203"
# Optional, can be used to sort releases, and as part of the changelogTemplate (__CYCLE_SHORT_HAND__).
# Useful for sorting because 1.2 comes after 1.10 in normal sorting, so using cycleShortHand values of 102, 110
# makes sorting much easier
cycleShortHand: "102"
# A link to the changelog for this specific release. Use this if the link is not
# predictable and you can't use changelogTemplate.
# Do not use a localized URL (such as one containing en-us) if possible
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ GEM
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
faraday (2.5.2)
faraday (2.6.0)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.0)
Expand Down
4 changes: 4 additions & 0 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,7 @@ There are no javascript trackers or analytics on the website. Netlify Analytics
## Automation

The endoflife.date project runs a bit of automation on top of GitHub Actions to automate mundane tasks. This is primarily updating the latest version of each product, wherever possible. This is documented in the [wiki](https://github.com/endoflife-date/endoflife.date/wiki/Automation).

## Bulk Updates

To faciliate bulk updates to the products, a script `_auto/bulk-update.py` is available. You only need to write in the `update` function to make changes to all files together.
58 changes: 58 additions & 0 deletions _auto/bulk-update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import sys
import frontmatter
import json
import re
import datetime
from glob import glob
from pathlib import Path
from distutils.version import StrictVersion
from ruamel.yaml import YAML
from io import StringIO
from os.path import exists

DEFAULT_POST_TEMPLATE = """\
---
{metadata}
---

{content}
"""

def yaml_to_str(obj):
yaml = YAML()
yaml.indent(sequence=4)
string_stream = StringIO()
yaml.dump(obj, string_stream)
output_str = string_stream.getvalue()
string_stream.close()
return output_str

"""
Takes a product dict
and return the updated version
"""
def update(obj):
return obj

def update_product(name):
fn = 'products/%s.md' % name
print(name)
with open(fn, 'r+') as f:
yaml = YAML()
yaml.preserve_quotes = True
data = next(yaml.load_all(f))
f.seek(0)
_, content = frontmatter.parse(f.read())

data = update(data)
final_contents = DEFAULT_POST_TEMPLATE.format(
metadata=yaml_to_str(data),
content=content)

f.seek(0)
f.truncate()
f.write(final_contents)

if __name__ == '__main__':
for x in glob('products/*.md'):
update_product(Path(x).stem)
5 changes: 1 addition & 4 deletions _auto/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ def validate_product(name):
yaml.preserve_quotes = True
data = next(yaml.load_all(f))
for r in data['releases']:
if 'cycleShortHand' in r:
if not isinstance(r['cycleShortHand'], str):
print("%s cycleShortHand=%s is not a string" % (name, r['cycleShortHand']))
fail = True
pass

f.seek(0)
_, content = frontmatter.parse(f.read())
Expand Down
20 changes: 16 additions & 4 deletions _layouts/product.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
{% if page.releaseColumn != false %}<th>Latest</th>{% endif %}
</tr>
</thead>
{% assign sorted_releases = page.releases | sort: page.sortReleasesBy | reverse %}
{% for r in sorted_releases %}

{% for r in page.releases %}
{% assign support =r.support | date: '%s' | plus:0 %}
{% assign securityFixes = r.eol | date: '%s' | plus:0 %}

Expand Down Expand Up @@ -56,13 +56,25 @@
{% assign LTSLabel = page.LTSLabel | default: '<abbr title="Long Term Support">LTS</abbr>' %}

{% if r.releaseLabel %}{% assign t=r.releaseLabel%}{%else%}{%assign t=page.releaseLabel | default: '__RELEASE_CYCLE__' %}{%endif%}
{% capture releaseCycleText %}{{t | replace: '__RELEASE_CYCLE__',r.releaseCycle | replace: '__LATEST__',latestVersionNumber | replace: '__LATEST_SHORT_HAND__',r.latestShortHand | replace: '__CYCLE_SHORT_HAND__',r.cycleShortHand | replace: '__CODENAME__',r.codename | liquify }}{% include ltslabel.html lts=r.lts label=LTSLabel %}{% endcapture %}
{% capture releaseCycleText %}{{
t |
replace: '__RELEASE_CYCLE__',r.releaseCycle |
replace: '__LATEST__',latestVersionNumber |
replace: '__CODENAME__',r.codename |
liquify
}}{% include ltslabel.html lts=r.lts label=LTSLabel %}{% endcapture %}

{% capture releaseLink %}
{% if r.link and diff > 0 %}
{{r.link}}
{% elsif page.changelogTemplate and diff > 0 %}
{{page.changelogTemplate | replace: '__RELEASE_CYCLE__',r.releaseCycle | replace: '__LATEST__',latestVersionNumber | replace: '__LATEST_SHORT_HAND__',r.latestShortHand | replace: '__CYCLE_SHORT_HAND__',r.cycleShortHand | replace: '__CODENAME__',r.codename | replace: '__LATEST_RELEASE_DATE__', r.latestReleaseDate}}
{{
page.changelogTemplate |
replace: '__RELEASE_CYCLE__',r.releaseCycle |
replace: '__LATEST__',latestVersionNumber |
replace: '__CODENAME__',r.codename |
replace: '__LATEST_RELEASE_DATE__', r.latestReleaseDate
}}
{% endif %}
{% endcapture %}
{% assign releaseLink = releaseLink | liquify | strip %}
Expand Down
11 changes: 10 additions & 1 deletion _plugins/create-json-files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@
require 'fileutils'
require 'json'
require 'yaml'
require 'date'

API_DIR = 'api'.freeze

def load_yaml(file)
if YAML.respond_to?(:unsafe_load)
YAML.unsafe_load_file(file)
else
YAML.load_file(self[:encoded_value])
end
end

class Product
attr_reader :hash

def initialize(markdown_file)
@hash = YAML.load_file(markdown_file)
@hash = load_yaml(markdown_file)
end

def permalink
Expand Down
11 changes: 10 additions & 1 deletion _plugins/validate-releases.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
require 'fileutils'
require 'json'
require 'yaml'
require 'date'

# These are fields we expect to be strings, but YAML
# picks up version numbers (like 3.10) as numbers and would
# format them to 3.1 instead. So we ensure these are always
# read as strings instead.
STRING_KEYS = ['latest', 'releaseCycle']

def load_yaml(file)
if YAML.respond_to?(:unsafe_load)
YAML.unsafe_load_file(file)
else
YAML.load_file(self[:encoded_value])
end
end

def process_files
success = true
Dir['products/*.md'].each do |markdown_file|
hash = YAML.load_file(markdown_file)
hash = @hash = load_yaml(markdown_file)
hash['releases'].each do |r|
STRING_KEYS.each do |k|
if r.key? k
Expand Down
12 changes: 0 additions & 12 deletions assets/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ paths:
/api/ubuntu.json:
value:
- cycle: '21.04'
cycleShortHand: HirsuteHippo
lts: false
releaseDate: '2021-04-22'
support: '2022-01-01'
eol: '2022-01-01'
latest: '21.04'
link: 'https://wiki.ubuntu.com/HirsuteHippo/ReleaseNotes/'
- cycle: '20.10'
cycleShortHand: GroovyGorilla
lts: false
releaseDate: '2020-10-22'
support: '2021-07-07'
Expand Down Expand Up @@ -88,7 +86,6 @@ paths:
link: 'https://www.python.org/downloads/release/python-395/'
/api/ubuntu/21.04.json:
value:
cycleShortHand: HirsuteHippo
lts: false
releaseDate: '2021-04-22'
support: '2022-01-01'
Expand Down Expand Up @@ -231,23 +228,20 @@ components:
link: 'https://github.com/python/cpython/blob/2.7/Misc/NEWS.d/2.7.18rc1.rst'
ubuntu:
- cycle: '21.04'
cycleShortHand: HirsuteHippo
lts: false
releaseDate: '2021-04-22'
support: '2022-01-01'
eol: '2022-01-01'
latest: '21.04'
link: 'https://wiki.ubuntu.com/HirsuteHippo/ReleaseNotes/'
- cycle: '20.10'
cycleShortHand: GroovyGorilla
lts: false
releaseDate: '2020-10-22'
support: '2021-07-07'
eol: '2021-07-07'
latest: '20.10'
link: 'https://wiki.ubuntu.com/GroovyGorilla/ReleaseNotes/'
- cycle: '20.04'
cycleShortHand: FocalFossa
lts: true
releaseDate: '2020-04-23'
support: '2022-10-01'
Expand All @@ -259,21 +253,18 @@ components:
eol: '2020-07-06'
latest: '19.10'
- cycle: '18.04'
cycleShortHand: BionicBeaver
lts: true
releaseDate: '2018-04-26'
support: '2020-09-30'
eol: '2023-04-02'
latest: 18.04.5
- cycle: '16.04'
cycleShortHand: XenialXerus
lts: true
releaseDate: '2016-04-21'
support: '2018-10-01'
eol: '2021-04-02'
latest: 16.04.7
- cycle: '14.04'
cycleShortHand: TrustyTahr
lts: true
releaseDate: '2014-04-17'
support: '2016-09-30'
Expand Down Expand Up @@ -323,9 +314,6 @@ components:
minLength: 10
maxLength: 10
description: Wheter this release cycle has active support
cycleShortHand:
type: string
description: Optional shorthand name for this release cycle
discontinued:
type:
- string
Expand Down
1 change: 0 additions & 1 deletion products/almalinux.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ versionCommand: lsb_release --release
releasePolicyLink: https://blog.cloudlinux.com/announcing-open-sourced-community-driven-rhel-fork-by-cloudlinux
activeSupportColumn: true
releaseDateColumn: true
sortReleasesBy: releaseDate
iconSlug: NA
changelogTemplate: https://wiki.almalinux.org/release-notes/__LATEST__.html
purls:
Expand Down
1 change: 0 additions & 1 deletion products/alpinelinux.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ purls:
auto:
# upstream does not support filtering https://git.alpinelinux.org/aports
- git: https://github.com/alpinelinux/aports.git
sortReleasesBy: 'releaseDate'
releases:
- releaseCycle: "3.16"
eol: 2024-05-23
Expand Down
12 changes: 6 additions & 6 deletions products/amazon-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ activeSupportColumn: false
versionCommand: cat /etc/system-release
eolColumn: Support
releaseDateColumn: true
sortReleasesBy: releaseDate
purls:
- purl: pkg:os/amazonlinux
auto:
Expand All @@ -19,17 +18,18 @@ auto:
changelogTemplate: |
https://docs.aws.amazon.com/AL2/latest/relnotes/relnotes-{{"__LATEST__"|slice:4,8 }}.html
releases:
- releaseCycle: '1'
releaseLabel: 'Amazon Linux AMI'
eol: 2020-12-31
latest: "2018.03"
releaseDate: "2010-09-14"
- releaseCycle: '2'
releaseLabel: 'Amazon Linux 2'
eol: 2024-06-30
latest: "2.0.20220912.1"
latestReleaseDate: 2022-09-22
releaseDate: 2018-06-26
- releaseCycle: '1'
releaseLabel: 'Amazon Linux AMI'
eol: 2020-12-31
latest: "2018.03"
releaseDate: 2010-09-14


---

Expand Down
2 changes: 0 additions & 2 deletions products/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ activeSupportColumn: false
releaseColumn: false
releaseDateColumn: true
eolColumn: Security Support
sortReleasesBy: releaseDate
releaseLabel: "Android __RELEASE_CYCLE__ '__CODENAME__'"
releases:
- releaseCycle: "13"
codename: Tiramisu
releaseLabel: Android 13 'Tiramisu'
eol: false
releaseDate: 2022-08-15

- releaseCycle: "12.1"
codename: Snow Cone v2
releaseLabel: Android 12.1 'Snow Cone v2' (aka 12L)
Expand Down
1 change: 0 additions & 1 deletion products/angular.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ versionCommand: ng version
releasePolicyLink: https://angular.io/guide/releases
activeSupportColumn: true
releaseDateColumn: true
sortReleasesBy: releaseDate
changelogTemplate: https://github.com/angular/angular/releases/tag/__LATEST__
purls:
- purl: pkg:npm/@angular/core
Expand Down
1 change: 0 additions & 1 deletion products/ansible.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ versionCommand: ansible --version
releasePolicyLink: https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html
changelogTemplate: https://github.com/ansible-community/ansible-build-data/blob/main/__RELEASE_CYCLE__/CHANGELOG-v__RELEASE_CYCLE__.rst
releaseDateColumn: true
sortReleasesBy: "releaseCycle"
activeSupportColumn: false
eolColumn: Supported
iconSlug: ansible
Expand Down
1 change: 0 additions & 1 deletion products/apache-airflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ activeSupportColumn: false
versionCommand: airflow version
releaseColumn: true
releaseDateColumn: true
sortReleasesBy: releaseDate
purls:
- purl: pkg:pypi/apache-airflow
- repology: apache-airflow
Expand Down
1 change: 0 additions & 1 deletion products/apache-http-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ activeSupportColumn: false
versionCommand: httpd -v
releaseColumn: true
releaseDateColumn: true
sortReleasesBy: "releaseCycle"
purls:
- repology: apache
releases:
Expand Down
Loading