mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-28 22:06:31 +00:00
fix(update): leave a service that aliases an anchor outside the services alone
A service whose whole mapping is an alias of an anchor defined elsewhere (direct: *base) shares that anchor's image line. Rewriting it bumped the anchor and with it every service merging it, a change the updater never planned. The compose collector now only takes services whose mapping is defined in place, so such a service keeps its pin. A unit test covers the case and fails on d231f796d9.
🎯 Fix: 94 %
💥 Break: 3 %
💸 Tokens: 100 %
⏱️ Velocity: 100 %
🛡️ Security: 100 %
🏆 Score: 91
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %
Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d231f796d9
commit
1ee446bfea
2 files changed
+43
-2
No files matched your search
@@ -425,6 +425,31 @@ class TestComposeBump(unittest.TestCase):
|
||||
original.replace(old, f"rpardini/docker-registry-proxy:{newest}"),
|
||||
)
|
||||
|
||||
def test_a_service_aliasing_an_anchor_outside_the_services_leaves_it_alone(self):
|
||||
aliased = (
|
||||
"x-base: &base\n"
|
||||
" image: redis:7.4.1\n"
|
||||
"services:\n"
|
||||
" direct: *base\n"
|
||||
" inherited:\n"
|
||||
" <<: *base\n"
|
||||
" local: &local\n"
|
||||
" image: nginx:1.27-alpine\n"
|
||||
" copy: *local\n"
|
||||
)
|
||||
rel = "ops/aliased.yml"
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
_write(root / rel, aliased)
|
||||
changed = _bump(root, [rel], TAGS)
|
||||
_reset_cache_for_tests()
|
||||
after = read_text(str(root / rel))
|
||||
|
||||
self.assertEqual(changed, [root / rel])
|
||||
self.assertEqual(
|
||||
after, aliased.replace("nginx:1.27-alpine", "nginx:1.29-alpine")
|
||||
)
|
||||
|
||||
def test_quoted_and_commented_tags_keep_their_quotes_and_comments(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
path = Path(tmp) / "cache.override.yml"
|
||||
|
||||
Reference in new issue
Block a user