Skip to content

Commit

Permalink
chore: fix archive version while logging (#144)
Browse files Browse the repository at this point in the history
Archive version was being changed to 23.1 instead 23.10 for values with
trailing zeroes. This commit fixes the bug.

https://github.com/canonical/chisel-releases/actions/runs/8014505888/job/21893215155?pr=143
  • Loading branch information
rebornplusplus authored Feb 23, 2024
1 parent a7aeba3 commit a5cf4a0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
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):
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

0 comments on commit a5cf4a0

Please sign in to comment.