mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
The runtime image pins lived in meta/distros.yml, which neither the docker updater, the image mirror nor the vulnerability scan reads, so a pin would only ever move by hand. The new role sys-os carries them in its meta/services.yml under the distro id; utils/distros.py renders the workspace matrix from there with the stdlib block reader, and meta/distros.yml keeps the distro attributes only. A new release now arrives as an updater pull request. follow: latest holds debian, ubuntu and fedora to the release their latest tag points at, by Docker Hub digest: Ubuntu moves between LTS releases only (26.10 shares the digest of rolling, not latest) and Fedora skips rawhide (46 shares the digest of rawhide, latest is 45). Arch stays rolling; CentOS stream tags carry no number the updater can order. dockerhub_repo and is_dockerhub move to utils/docker/image/ref.py beside split_registry_and_name, so utils/update/follow.py can use them without an import cycle and utils/update/docker.py stays under the size cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
from __future__ import annotations
|
|
|
|
import unittest
|
|
from unittest import mock
|
|
|
|
from utils.update.follow import followed_tags
|
|
|
|
UBUNTU = {
|
|
"latest": "sha256:lts",
|
|
"26.04": "sha256:lts",
|
|
"26.10": "sha256:interim",
|
|
"rolling": "sha256:interim",
|
|
}
|
|
FEDORA = {
|
|
"latest": "sha256:45",
|
|
"44": "sha256:44",
|
|
"45": "sha256:45",
|
|
"46": "sha256:rawhide",
|
|
"rawhide": "sha256:rawhide",
|
|
}
|
|
|
|
|
|
def _digests(table: dict[str, str]):
|
|
return lambda _image, tag: table[tag]
|
|
|
|
|
|
class TestFollowedTags(unittest.TestCase):
|
|
def test_ubuntu_on_the_lts_gets_no_interim_release(self) -> None:
|
|
with mock.patch("utils.update.follow.tag_digest", _digests(UBUNTU)):
|
|
found = followed_tags("ubuntu", list(UBUNTU), {"follow": "latest"}, "26.04")
|
|
self.assertEqual(found, [])
|
|
|
|
def test_fedora_moves_to_the_stable_release_not_rawhide(self) -> None:
|
|
with mock.patch("utils.update.follow.tag_digest", _digests(FEDORA)):
|
|
found = followed_tags("fedora", list(FEDORA), {"follow": "latest"}, "44")
|
|
self.assertEqual(found, ["45"])
|
|
|
|
def test_an_entity_without_follow_keeps_every_tag(self) -> None:
|
|
tags = list(FEDORA)
|
|
self.assertEqual(followed_tags("fedora", tags, {"version": "44"}, "44"), tags)
|
|
self.assertEqual(followed_tags("fedora", tags, None, "44"), tags)
|
|
|
|
def test_an_unreadable_registry_proposes_nothing(self) -> None:
|
|
with mock.patch("utils.update.follow.tag_digest", side_effect=OSError):
|
|
found = followed_tags("fedora", list(FEDORA), {"follow": "latest"}, "44")
|
|
self.assertEqual(found, [])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|