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

chore: fix archive version while logging #144

Merged
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
7 changes: 4 additions & 3 deletions .github/scripts/install_slices/install_slices.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ def parse_archive(release: str) -> Archive:
sys.exit(1)
# load the yaml data into Archive
archive_data = data["archives"]["ubuntu"]
archive = Archive(
str(archive_data["version"]), archive_data["components"], archive_data["suites"]
)
version = archive_data["version"]
if isinstance(version, float):
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there ever a time where this won't be a float?

Choose a reason for hiding this comment

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

is there ever a time where this won't be a float?

I think that may happen if something encloses the version with quotes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Since the chisel tool expects and reads version as a string, someone can enclose it in quotes as Anas mentioned.

version = f"{version:.2f}"
archive = Archive(str(version), archive_data["components"], archive_data["suites"])
return archive


Expand Down
16 changes: 16 additions & 0 deletions .github/scripts/install_slices/test_install_slices.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@ def test_parse_archive(self):
# test parsing remote release
archive = parse_archive("ubuntu-22.04")
self.assertEqual(archive, DEFAULT_ARCHIVE)
# test parsing archive version properly
chisel_yaml = DEFAULT_CHISEL_YAML.replace("22.04", "23.10")
chisel_yaml = chisel_yaml.replace("jammy", "mantic")
with tempfile.TemporaryDirectory() as tmpfs:
filepath = os.path.join(tmpfs, "chisel.yaml")
with open(filepath, "w", encoding="utf-8") as file:
file.write(chisel_yaml)
archive = parse_archive(tmpfs)
self.assertEqual(
archive,
Archive(
version="23.10",
components=["main", "universe"],
suites=["mantic", "mantic-security", "mantic-updates"],
),
)

def test_full_slice_name(self):
"""
Expand Down
Loading