mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
The Docker updater watches image plus version, the repository updater
repository plus ref. A dozen pins fell outside both - an app_version, a
release, a tag in a registry neither speaks - so nothing ever told anyone
they had gone stale.
Such a pin now names its upstream next to itself in an `update:` block:
git_tags, registry_tags, npm, http_regex or a role-local script, with
`match` selecting a tag flavour and `strip` removing a prefix the pin does
not carry. utils/update/source.py resolves them beside the two existing
updaters, `python -m cli.contributing.update.source` bumps them, the
update-version-sources job opens one PR per role, and
tests/external/update/source warns while a bump is pending.
Two lints hold the rule: every semver pin is watched by one of the three
updaters or opted out with a reason, and a semver only ever sits behind
`version`, `<what>_version` or `ref` - which renames moodle's release to
app_version and simpleicons' local_version to local_tag, the latter being
the tag of a locally built image rather than an upstream version. A
declaration naming a key the entity does not carry, or a type the resolver
does not know, fails the lint instead of resolving nothing in silence.
Picked from feature/store-i18n (94d607fd0a) onto current main. Two things
differ from the original: svc-ai-lmstudio no longer carries an app_version
pin, so its declaration is dropped, and web-app-stalwart's webui_version,
added since, declares the git tags of the webui repository.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
63 lines
2.3 KiB
Python
63 lines
2.3 KiB
Python
"""Warn about pins whose declared upstream has moved ahead.
|
|
|
|
A pin outside the Docker and repository updaters names its upstream in an
|
|
``update:`` block of ``roles/*/meta/services.yml``. This test resolves each
|
|
declared source and warns when it offers a newer version.
|
|
|
|
Counterpart to ``tests/external/update/docker/test_image_versions.py`` and
|
|
``tests/external/update/repository/test_repository_versions.py``. The shared
|
|
logic lives in :mod:`utils.update.source`; the CI auto-update job at
|
|
``.github/workflows/cron-update.yml`` (``update-version-sources``) consumes the
|
|
same module to open PRs against ``main``.
|
|
|
|
External test: depends on live registry, npm, git and HTTP calls. It always
|
|
passes, so normal validation stays stable when an upstream is slow or
|
|
unreachable; outdated pins surface as warnings and as GitHub Actions
|
|
annotations on the offending line.
|
|
|
|
Suppress a check with ``# nocheck: version-source`` on the line above the pin.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import unittest
|
|
|
|
from utils.annotations.message import warning
|
|
from utils.update.source import collect_entries, find_outdated_updates
|
|
|
|
from . import PROJECT_ROOT
|
|
|
|
|
|
class TestVersionSources(unittest.TestCase):
|
|
"""Warn about outdated pins that declare their own upstream source."""
|
|
|
|
def test_declared_version_sources_are_current(self) -> None:
|
|
entries = collect_entries(PROJECT_ROOT)
|
|
updates = find_outdated_updates(PROJECT_ROOT)
|
|
|
|
if updates:
|
|
rows = "\n".join(
|
|
f"{u.entry.role}/{u.entry.entity}.{u.entry.key}: "
|
|
f"{u.entry.current} -> {u.latest} ({u.entry.source.get('type')})"
|
|
for u in updates
|
|
)
|
|
print(
|
|
f"\n⚠️ Outdated version pins:\n{rows}\n"
|
|
"\n💡 To suppress a warning add above the pinned key:\n"
|
|
" # nocheck: version-source"
|
|
)
|
|
for u in updates:
|
|
warning(
|
|
f"{u.entry.role}/{u.entry.entity}.{u.entry.key} is at "
|
|
f"{u.entry.current}, its source offers {u.latest}",
|
|
title="Outdated version pin",
|
|
file=str(u.entry.config_path.relative_to(PROJECT_ROOT)),
|
|
line=u.entry.line,
|
|
)
|
|
|
|
self.assertIsNotNone(entries)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|