-
Notifications
You must be signed in to change notification settings - Fork 1
images info for release notes #217
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b2214ae
images info for release notes
vivus-ignis 5b10c9d
working deployment platform classes
vivus-ignis 583a547
removing unused code
vivus-ignis f3a3b37
gitignore update
vivus-ignis f33a40a
cleanup; tests for github cli
vivus-ignis 880f538
gitignore update
vivus-ignis 6064d23
no glob for test artifacts metadata files
vivus-ignis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,3 +169,6 @@ bandit-report.json | |
|
|
||
| # zot | ||
| test-data/zot | ||
|
|
||
| s3_downloads/ | ||
| .github_release_id | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
src/gardenlinux/github/release_notes/deployment_platform/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| from gardenlinux.constants import GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME | ||
|
|
||
|
|
||
| class DeploymentPlatform(): | ||
| artifacts_bucket_name = GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME | ||
|
|
||
| def short_name(self): | ||
| return "generic" | ||
|
|
||
| def full_name(self): | ||
| return "Generic Deployment Platform" | ||
|
|
||
| def published_images_by_regions(self, image_metadata): | ||
| published_image_metadata = image_metadata["published_image_metadata"] | ||
| flavor_name = image_metadata["s3_key"].split("/")[-1] | ||
|
|
||
| regions = [] | ||
| for pset in published_image_metadata: | ||
| for p in published_image_metadata[pset]: | ||
| regions.append({"region": p["region_id"], "image_id": p["image_id"]}) | ||
|
|
||
| return {"flavor": flavor_name, "regions": regions} | ||
|
|
||
| def image_extension(self): | ||
| return "raw" | ||
|
|
||
| def artifact_for_flavor(self, flavor, markdown_format=True): | ||
| base_url = f"https://{self.__class__.artifacts_bucket_name}.s3.amazonaws.com/objects" | ||
| filename = f"{flavor}.{self.image_extension()}" | ||
| download_url = f"{base_url}/{flavor}/{filename}" | ||
| if markdown_format: | ||
| return f"[{filename}]({download_url})" | ||
| else: | ||
| return download_url | ||
|
|
||
| def region_details(self, image_metadata): | ||
| """ | ||
| Generate the detailed region information for the collapsible section | ||
| """ | ||
| details = "" | ||
|
|
||
| match self.published_images_by_regions(image_metadata): | ||
| case {"regions": regions}: | ||
| for region in regions: | ||
| match region: | ||
| case { | ||
| "region": region_name, | ||
| "image_id": image_id, | ||
| "image_name": image_name, | ||
| }: | ||
| details += f"**{region_name}:** {image_id} ({image_name})<br>" | ||
| case {"region": region_name, "image_id": image_id}: | ||
| details += f"**{region_name}:** {image_id}<br>" | ||
| case {"details": details_dict}: | ||
| for key, value in details_dict.items(): | ||
| details += f"**{key.replace('_', ' ').title()}:** {value}<br>" | ||
| case { | ||
| "gallery_images": gallery_images, | ||
| "marketplace_images": marketplace_images, | ||
| }: | ||
| if gallery_images: | ||
| details += "**Gallery Images:**<br>" | ||
| for img in gallery_images: | ||
| details += f"• {img['hyper_v_generation']} ({img['azure_cloud']}): {img['image_id']}<br>" | ||
| if marketplace_images: | ||
| details += "**Marketplace Images:**<br>" | ||
| for img in marketplace_images: | ||
| details += f"• {img['hyper_v_generation']}: {img['urn']}<br>" | ||
| case {"gallery_images": gallery_images}: | ||
| details += "**Gallery Images:**<br>" | ||
| for img in gallery_images: | ||
| details += f"• {img['hyper_v_generation']} ({img['azure_cloud']}): {img['image_id']}<br>" | ||
| case {"marketplace_images": marketplace_images}: | ||
| details += "**Marketplace Images:**<br>" | ||
| for img in marketplace_images: | ||
| details += f"• {img['hyper_v_generation']}: {img['urn']}<br>" | ||
|
|
||
| return details | ||
|
|
||
| def summary_text(self, image_metadata): | ||
| """ | ||
| Generate the summary text for the collapsible section | ||
| """ | ||
| match self.published_images_by_regions(image_metadata): | ||
| case {"regions": regions}: | ||
| count = len(regions) | ||
| return f"{count} regions" | ||
| case {"details": _}: | ||
| return "Global availability" | ||
| case { | ||
| "gallery_images": gallery_images, | ||
| "marketplace_images": marketplace_images, | ||
| }: | ||
| gallery_count = len(gallery_images) | ||
| marketplace_count = len(marketplace_images) | ||
| return f"{gallery_count} gallery + {marketplace_count} marketplace images" | ||
| case {"gallery_images": gallery_images}: | ||
| gallery_count = len(gallery_images) | ||
| return f"{gallery_count} gallery images" | ||
| case {"marketplace_images": marketplace_images}: | ||
| marketplace_count = len(marketplace_images) | ||
| return f"{marketplace_count} marketplace images" | ||
| case _: | ||
| return "Details available" |
12 changes: 12 additions & 0 deletions
12
src/gardenlinux/github/release_notes/deployment_platform/ali_cloud.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| from . import DeploymentPlatform | ||
|
|
||
|
|
||
| class AliCloud(DeploymentPlatform): | ||
| def short_name(self): | ||
| return "ali" | ||
|
|
||
| def full_name(self): | ||
| return "Alibaba Cloud" | ||
|
|
||
| def image_extension(self): | ||
| return "qcow2" | ||
20 changes: 20 additions & 0 deletions
20
src/gardenlinux/github/release_notes/deployment_platform/amazon_web_services.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| from . import DeploymentPlatform | ||
|
|
||
|
|
||
| class AmazonWebServices(DeploymentPlatform): | ||
| def short_name(self): | ||
| return "aws" | ||
|
|
||
| def full_name(self): | ||
| return "Amazon Web Services" | ||
|
|
||
| def published_images_by_regions(self, image_metadata): | ||
| published_image_metadata = image_metadata["published_image_metadata"] | ||
| flavor_name = image_metadata["s3_key"].split("/")[-1] | ||
|
|
||
| regions = [] | ||
| for pset in published_image_metadata: | ||
| for p in published_image_metadata[pset]: | ||
| regions.append({"region": p["aws_region_id"], "image_id": p["ami_id"]}) | ||
|
|
||
| return {"flavor": flavor_name, "regions": regions} |
45 changes: 45 additions & 0 deletions
45
src/gardenlinux/github/release_notes/deployment_platform/azure.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| from . import DeploymentPlatform | ||
|
|
||
|
|
||
| class Azure(DeploymentPlatform): | ||
| def short_name(self): | ||
| return "azure" | ||
|
|
||
| def full_name(self): | ||
| return "Microsoft Azure" | ||
|
|
||
| def image_extension(self): | ||
| return "vhd" | ||
|
|
||
| def published_images_by_regions(self, image_metadata): | ||
| published_image_metadata = image_metadata["published_image_metadata"] | ||
| flavor_name = image_metadata["s3_key"].split("/")[-1] | ||
|
|
||
| gallery_images = [] | ||
| marketplace_images = [] | ||
|
|
||
| for pset in published_image_metadata: | ||
| if pset == "published_gallery_images": | ||
| for gallery_image in published_image_metadata[pset]: | ||
| gallery_images.append( | ||
| { | ||
| "hyper_v_generation": gallery_image["hyper_v_generation"], | ||
| "azure_cloud": gallery_image["azure_cloud"], | ||
| "image_id": gallery_image["community_gallery_image_id"], | ||
| } | ||
| ) | ||
|
|
||
| if pset == "published_marketplace_images": | ||
| for market_image in published_image_metadata[pset]: | ||
| marketplace_images.append( | ||
| { | ||
| "hyper_v_generation": market_image["hyper_v_generation"], | ||
| "urn": market_image["urn"], | ||
| } | ||
| ) | ||
|
|
||
| return { | ||
| "flavor": flavor_name, | ||
| "gallery_images": gallery_images, | ||
| "marketplace_images": marketplace_images, | ||
| } |
25 changes: 25 additions & 0 deletions
25
src/gardenlinux/github/release_notes/deployment_platform/google_cloud.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| from . import DeploymentPlatform | ||
|
|
||
|
|
||
| class GoogleCloud(DeploymentPlatform): | ||
| def short_name(self): | ||
| return "gcp" | ||
|
|
||
| def full_name(self): | ||
| return "Google Cloud Platform" | ||
|
|
||
| def image_extension(self): | ||
| return "gcpimage.tar.gz" | ||
|
|
||
| def published_images_by_regions(self, image_metadata): | ||
| published_image_metadata = image_metadata["published_image_metadata"] | ||
| flavor_name = image_metadata["s3_key"].split("/")[-1] | ||
|
|
||
| details = {} | ||
| if "gcp_image_name" in published_image_metadata: | ||
| details["image_name"] = published_image_metadata["gcp_image_name"] | ||
| if "gcp_project_name" in published_image_metadata: | ||
| details["project"] = published_image_metadata["gcp_project_name"] | ||
| details["availability"] = "Global (all regions)" | ||
|
|
||
| return {"flavor": flavor_name, "details": details} |
26 changes: 26 additions & 0 deletions
26
src/gardenlinux/github/release_notes/deployment_platform/openstack.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| from . import DeploymentPlatform | ||
|
|
||
|
|
||
| class OpenStack(DeploymentPlatform): | ||
| def short_name(self): | ||
| return "openstack" | ||
|
|
||
| def full_name(self): | ||
| return "OpenStack" | ||
|
|
||
| def published_images_by_regions(self, image_metadata): | ||
| published_image_metadata = image_metadata["published_image_metadata"] | ||
| flavor_name = image_metadata["s3_key"].split("/")[-1] | ||
|
|
||
| regions = [] | ||
| if "published_openstack_images" in published_image_metadata: | ||
| for image in published_image_metadata["published_openstack_images"]: | ||
| regions.append( | ||
| { | ||
| "region": image["region_name"], | ||
| "image_id": image["image_id"], | ||
| "image_name": image["image_name"], | ||
| } | ||
| ) | ||
|
|
||
| return {"flavor": flavor_name, "regions": regions} |
9 changes: 9 additions & 0 deletions
9
src/gardenlinux/github/release_notes/deployment_platform/openstack_baremetal.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from .openstack import OpenStack | ||
|
|
||
|
|
||
| class OpenStackBareMetal(OpenStack): | ||
| def short_name(self): | ||
| return "openstackbaremetal" | ||
|
|
||
| def full_name(self): | ||
| return "OpenStack Baremetal" | ||
|
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. Don't we miss the
Contributor
Author
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. For some platforms superclass' version is used. |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should this not be a dataclass?
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.
Could very well be.