-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add 'deprecated' field for depreacted section generation in image docs #203
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
{ | ||
"latest": { | ||
"candidate": { | ||
"target": "283" | ||
"target": "1.0-22.04_candidate" | ||
}, | ||
"beta": { | ||
"target": "283" | ||
"target": "latest_candidate" | ||
}, | ||
"edge": { | ||
"target": "283" | ||
"target": "latest_beta" | ||
}, | ||
"end-of-life": "2025-05-01T00:00:00Z" | ||
}, | ||
"1.0-22.04": { | ||
"candidate": { | ||
"target": "283" | ||
"target": "316" | ||
}, | ||
"beta": { | ||
"target": "283" | ||
"target": "316" | ||
}, | ||
"edge": { | ||
"target": "283" | ||
"target": "316" | ||
}, | ||
"end-of-life": "2025-05-01T00:00:00Z" | ||
}, | ||
"test": { | ||
"beta": { | ||
"target": "283" | ||
"target": "1.0-22.04_beta" | ||
}, | ||
"edge": { | ||
"target": "283" | ||
"target": "test_beta" | ||
}, | ||
"end-of-life": "2026-05-01T00:00:00Z" | ||
}, | ||
"1.1-22.04": { | ||
"end-of-life": "2025-05-01T00:00:00Z", | ||
"candidate": { | ||
"target": "284" | ||
"target": "317" | ||
}, | ||
"beta": { | ||
"target": "284" | ||
"target": "317" | ||
}, | ||
"edge": { | ||
"target": "284" | ||
"target": "317" | ||
} | ||
}, | ||
"1-22.04": { | ||
"end-of-life": "2025-05-01T00:00:00Z", | ||
"candidate": { | ||
"target": "284" | ||
"target": "317" | ||
}, | ||
"beta": { | ||
"target": "284" | ||
"target": "317" | ||
}, | ||
"edge": { | ||
"target": "284" | ||
"target": "317" | ||
} | ||
}, | ||
"1.2-22.04": { | ||
"end-of-life": "2025-05-01T00:00:00Z", | ||
"beta": { | ||
"target": "285" | ||
"target": "318" | ||
}, | ||
"edge": { | ||
"target": "285" | ||
"target": "1.2-22.04_beta" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
from datetime import datetime, timezone | ||
import glob | ||
import json | ||
import os | ||
|
@@ -53,8 +54,10 @@ def validate_image_trigger(data: dict) -> None: | |
builds = image_trigger.get("upload", []) | ||
|
||
release_to = "true" if "release" in image_trigger else "" | ||
|
||
img_number = 0 | ||
# inject some extra metadata into the matrix data | ||
for img_number, _ in enumerate(builds): | ||
while img_number < len(builds): | ||
builds[img_number]["name"] = args.oci_path.rstrip("/").split("/")[-1] | ||
builds[img_number]["path"] = args.oci_path | ||
# make sure every build of this image has a unique identifier | ||
|
@@ -69,13 +72,23 @@ def validate_image_trigger(data: dict) -> None: | |
|
||
# set an output as a marker for later knowing if we need to release | ||
if "release" in builds[img_number]: | ||
release_to = "true" | ||
# the workflow GH matrix has a problem parsing nested JSON dicts | ||
# so let's remove this field since we don't need it for the builds | ||
builds[img_number]["release"] = "true" | ||
min_eol = datetime.strptime(min( | ||
v["end-of-life"] for v in builds[img_number]["release"].values() | ||
), "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc) | ||
if min_eol < datetime.now(timezone.utc): | ||
Comment on lines
+76
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI these dates are ISO formatted, so you should be able to compare them as strings |
||
print("Track skipped because it reached its end of life") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this too late? I.e. the |
||
del builds[img_number] | ||
continue | ||
else: | ||
release_to = "true" | ||
# the workflow GH matrix has a problem parsing nested JSON dicts | ||
# so let's remove this field since we don't need it for the builds | ||
builds[img_number]["release"] = "true" | ||
else: | ||
builds[img_number]["release"] = "" | ||
|
||
img_number += 1 | ||
|
||
matrix = {"include": builds} | ||
print(f"{args.oci_path} - build matrix:\n{json.dumps(matrix, indent=4)}") | ||
with open(os.environ["GITHUB_OUTPUT"], "a") as gh_out: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't use datetime.UTC? https://docs.python.org/3/library/datetime.html#datetime.UTC