Skip to content

Implement build OS parsing into ImageVersionOS#184

Merged
ianpittwood merged 2 commits intomainfrom
build-os-impl
Sep 9, 2025
Merged

Implement build OS parsing into ImageVersionOS#184
ianpittwood merged 2 commits intomainfrom
build-os-impl

Conversation

@ianpittwood
Copy link
Contributor

@ianpittwood ianpittwood commented Sep 4, 2025

Stacks on #182

@github-actions
Copy link

github-actions bot commented Sep 4, 2025

Test Results

444 tests   444 ✅  1m 26s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit c819cc2.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@bschwedler bschwedler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this!

("Ubuntu 22", SUPPORTED_OS["ubuntu"]["22"]),
("Ubuntu 24.04", SUPPORTED_OS["ubuntu"]["24"]),
("Ubuntu 24", SUPPORTED_OS["ubuntu"]["24"]),
("Ubuntu", SUPPORTED_OS["ubuntu"]["24"]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice this is the only test that defaults to the latest of a version isn't specified. The code looks like it will do this for other OSes as well.

Should we add some tests for the other OSes?
Yes, I know we will have to keep the test up-to-date with the config, but I think that's a good thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for noticing this. I was just kind of adding them willy-nilly to cover all the perceived combinations. This made me realize that the way I was grabbing the latest version was using the max string, not the max integer.

Comment on lines 106 to 112
# If only the name is provided and it's an unversioned OS, use it.
if isinstance(SUPPORTED_OS.get(match_dict["name"]), BuildOS):
return SUPPORTED_OS[match_dict["name"]]
# Otherwise, use the latest version of the matching OS name if possible.
else:
latest = max(SUPPORTED_OS[match_dict["name"]].keys())
return SUPPORTED_OS[match_dict["name"]][latest]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a bit to understand how this worked, but I now get that we skip the version key in the dict for OSes that we aren't listing specific versions

Base automatically changed from alternate-product-versions-retrieval to main September 9, 2025 18:13
Fix string sort to int sort for finding latest version
@ianpittwood ianpittwood merged commit 59e1af4 into main Sep 9, 2025
3 checks passed
@ianpittwood ianpittwood deleted the build-os-impl branch September 9, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants