Skip to content

Commit

Permalink
fix: make changelog work with bluefin LTS and try to fix manual actio…
Browse files Browse the repository at this point in the history
…ns run (#277)
  • Loading branch information
tulilirockz authored Feb 10, 2025
1 parent 9a1ac59 commit 2d18380
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 24 deletions.
52 changes: 31 additions & 21 deletions .github/changelogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@

REGISTRY = "docker://ghcr.io/ublue-os/"

IMAGE_MATRIX_LATEST = {
"experience": ["base"],
"image_flavor": ["main"], # hwe eventually
IMAGE_MATRIX = {
"experience": ["base", "dx", "gdx"],
"de": ["gnome"],
"image_flavor": ["main", "hwe"],
}

RETRIES = 3
RETRY_WAIT = 5
FEDORA_PATTERN = re.compile(r"\.fc\d\d")
START_PATTERN = lambda target: re.compile(rf"{target}\.\d\d\d+")
START_PATTERN = lambda target: re.compile(rf"{target}-\d\d\d+")

PATTERN_ADD = "\n| ✨ | {name} | | {version} |"
PATTERN_CHANGE = "\n| 🔄 | {name} | {prev} | {new} |"
Expand All @@ -26,8 +27,9 @@
COMMON_PAT = "### All Images\n| | Name | Previous | New |\n| --- | --- | --- | --- |{changes}\n\n"
OTHER_NAMES = {
"base": "### Base Images\n| | Name | Previous | New |\n| --- | --- | --- | --- |{changes}\n\n",
"dx": "### [Dev Experience Images](https://docs.projectbluefin.io/achillobator)\n| | Name | Previous | New |\n| --- | --- | --- | --- |{changes}\n\n",
"gnome": "### [Bluefin LTS Images](https://projectbluefin.io/)\n| | Name | Previous | New |\n| --- | --- | --- | --- |{changes}\n\n",
"dx": "### [Developer Experience Images](https://docs.projectbluefin.io/bluefin-dx)\n| | Name | Previous | New |\n| --- | --- | --- | --- |{changes}\n\n",
"gdx": "### [Graphical Developer Experience Images](https://docs.projectbluefin.io/gdx)\n| | Name | Previous | New |\n| --- | --- | --- | --- |{changes}\n\n",
"gnome": "### [Bluefin LTS Images](https://docs.projectbluefin.io/lts)\n| | Name | Previous | New |\n| --- | --- | --- | --- |{changes}\n\n",
"nvidia": "### Nvidia Images\n| | Name | Previous | New |\n| --- | --- | --- | --- |{changes}\n\n",
"hwe": "### HWE Images\n| | Name | Previous | New |\n| --- | --- | --- | --- |{changes}\n\n",
}
Expand All @@ -53,9 +55,9 @@
### Major DX packages
| Name | Version |
| --- | --- |
| **Incus** | {pkgrel:incus} |
| **Docker** | {pkgrel:docker-ce} |
| **Devpod** | {pkgrel:devpod} |
| **VSCode** | {pkgrel:code} |
| **Ramalama** | {pkgrel:python3-ramalama} |
{changes}
Expand All @@ -73,7 +75,7 @@
```
### Documentation
Be sure to read the [documentation](https://docs.projectbluefin.io/) for more information
Be sure to read the [documentation](https://docs.projectbluefin.io/lts) for more information
on how to use your cloud native system.
"""
HANDWRITTEN_PLACEHOLDER = """\
Expand All @@ -86,28 +88,38 @@
"podman",
"docker-ce",
"incus",
"devpod",
"vscode",
"nvidia-driver"
]


def get_images(target: str):
matrix = IMAGE_MATRIX_LATEST
matrix = IMAGE_MATRIX

for experience, image_flavor in product(*matrix.values()):
img = "bluefin"
for experience, de, image_flavor in product(*matrix.values()):
img = ""
if de == "gnome":
img += "bluefin"

if experience == "dx":
img += "-dx"

if experience == "gdx":
if image_flavor == "hwe":
continue
img += "-gdx"

if image_flavor != "main":
img += "-"
img += image_flavor

yield img, experience, image_flavor
yield img, experience, de, image_flavor


def get_manifests(target: str):
out = {}
imgs = list(get_images(target))
for j, (img, _, _) in enumerate(imgs):
for j, (img, _, _, _) in enumerate(imgs):
output = None
print(f"Getting {img}:{target} manifest ({j+1}/{len(imgs)}).")
for i in range(RETRIES):
Expand Down Expand Up @@ -179,7 +191,7 @@ def get_package_groups(target: str, prev: dict[str, Any], manifests: dict[str, A

# Find common packages
first = True
for img, experience, image_flavor in get_images(target):
for img, experience, de, image_flavor in get_images(target):
if img not in pkg:
continue

Expand All @@ -196,14 +208,16 @@ def get_package_groups(target: str, prev: dict[str, Any], manifests: dict[str, A
# Find other packages
for t, other in others.items():
first = True
for img, experience, image_flavor in get_images(target):
for img, experience, de, image_flavor in get_images(target):
if img not in pkg:
continue

if t == "hwe" and "hwe" not in image_flavor:
continue
if t == "nvidia" and "nvidia" not in image_flavor:
continue
if t == "gnome" and de != "gnome":
continue
if t == "base" and experience != "base":
continue
if t == "dx" and experience != "dx":
Expand Down Expand Up @@ -420,9 +434,6 @@ def main():
# Tags cannot include / anyway.
target = args.target.split('/')[-1]

if target == "main":
target = "stable"

manifests = get_manifests(target)
prev, curr = get_tags(target, manifests)
print(f"Previous tag: {prev}")
Expand Down Expand Up @@ -450,4 +461,3 @@ def main():

if __name__ == "__main__":
main()

11 changes: 8 additions & 3 deletions .github/workflows/generate-changelog-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ on:
stream_name:
description: "Release Tag (e.g. gts, stable)"
required: false
default: '["latest"]'
default: '["lts"]'
type: choice
options:
- '["stream10"]'
- '["latest"]'
- '["stream10","latest"]'
- '["lts"]'
- '["stream10","lts"]'

permissions:
contents: write
Expand All @@ -35,6 +35,11 @@ jobs:
- name: Get stream with fallback
id: streams
run: |
set -x
if [ "${{ github.event.inputs.stream_name }}" != ""] ; then
echo "stream_names=${{ github.event.inputs.stream_name }}" >> $GITHUB_OUTPUT
fi
if [ "${{ inputs.stream_name }}" == "" ] ; then
echo "stream_names=[\"latest\"]" >> $GITHUB_OUTPUT
exit 0
Expand Down

0 comments on commit 2d18380

Please sign in to comment.