Skip to content

fix: use separate default tag patterns for matrix images#418

Merged
ianpittwood merged 1 commit into
mainfrom
fix-matrix-tag-pattern-renders
Apr 3, 2026
Merged

fix: use separate default tag patterns for matrix images#418
ianpittwood merged 1 commit into
mainfrom
fix-matrix-tag-pattern-renders

Conversation

@ianpittwood
Copy link
Copy Markdown
Contributor

@ianpittwood ianpittwood commented Apr 3, 2026

Summary

  • The stripMetadata Jinja2 filter strips from the last hyphen onward, which breaks composite matrix version names like R4.3.3-python3.11.15 by collapsing them to R4.3.3, causing tag collisions across matrix combinations
  • Added default_matrix_tag_patterns() which excludes stripMetadata patterns and latest-filtered patterns (matrices are naive to "latest")
  • The Image model now conditionally selects the pattern set based on whether a matrix is defined, using Pydantic's default_factory with validated data

Fixes #417

Test plan

  • Existing tag and image config tests pass
  • New test_default_matrix_tag_patterns verifies correct rendering of matrix tag patterns
  • New test_default_matrix_tag_patterns_no_strip_metadata asserts no stripMetadata in matrix patterns
  • New test_default_matrix_tag_patterns_no_latest_filter asserts no LATEST filter in matrix patterns
  • New test_default_matrix_tag_patterns_no_tag_collisions regression test verifies no tag overlaps across matrix combinations
  • New test_default_tag_patterns_for_matrix_image verifies matrix images get the correct default patterns
  • New test_explicit_tag_patterns_not_overridden_by_matrix verifies explicit tagPatterns are respected
  • Run bakery build --matrix-versions only --image-name 'workbench-session$' --plan in images-workbench to verify no overlapping tags

🤖 Generated with Claude Code

@ianpittwood ianpittwood requested a review from bschwedler as a code owner April 3, 2026 13:21
Copy link
Copy Markdown
Contributor

@bschwedler bschwedler left a comment

Choose a reason for hiding this comment

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

This definitely explains some of the failures I've seen in the cache builds.

Thanks!

…ag collisions

The stripMetadata Jinja2 filter strips from the last hyphen onward, which
breaks composite matrix version names like "R4.3.3-python3.11.15" by
collapsing them to "R4.3.3". This caused multiple matrix combinations to
produce identical tags, leading to image overwrites during builds.

Add default_matrix_tag_patterns() which excludes stripMetadata patterns
and latest-filtered patterns (matrices are naive to "latest"). The Image
model now conditionally selects the pattern set based on whether a matrix
is defined, using Pydantic's default_factory with validated data.

Fixes #417

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ianpittwood ianpittwood force-pushed the fix-matrix-tag-pattern-renders branch from 882123f to c4dcc0e Compare April 3, 2026 13:34
@ianpittwood ianpittwood enabled auto-merge April 3, 2026 13:35
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 3, 2026

Test Results

1 254 tests  +6   1 254 ✅ +6   13m 21s ⏱️ +22s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit c4dcc0e. ± Comparison against base commit 574cbe6.

@ianpittwood ianpittwood added this pull request to the merge queue Apr 3, 2026
Merged via the queue into main with commit a370e94 Apr 3, 2026
16 checks passed
@ianpittwood ianpittwood deleted the fix-matrix-tag-pattern-renders branch April 3, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compound tags generated for matrices can be truncated

2 participants