Skip to content

GH-7196: More lenient regex for container image templating#3421

Merged
pingsutw merged 5 commits intoflyteorg:masterfrom
Tom-Newton:tomnewton/more_lenient_regex_for_container_image_templating/GH-7196
Apr 10, 2026
Merged

GH-7196: More lenient regex for container image templating#3421
pingsutw merged 5 commits intoflyteorg:masterfrom
Tom-Newton:tomnewton/more_lenient_regex_for_container_image_templating/GH-7196

Conversation

@Tom-Newton
Copy link
Copy Markdown
Contributor

Tracking issue

flyteorg/flyte#7196

Why are the changes needed?

Something that I fully expected to work didn't work and it took me hours to debug.

What changes were proposed in this pull request?

How was this patch tested?

Updated unittests

Check all the applicable boxes

  • I updated the documentation accordingly - I'm not sure there is anything worth updating
  • All new and existing tests passed.
  • All commits are signed-off.

Signed-off-by: Thomas Newton <thomas.w.newton@gmail.com>
Signed-off-by: Thomas Newton <thomas.w.newton@gmail.com>
Signed-off-by: Thomas Newton <thomas.w.newton@gmail.com>
Signed-off-by: Thomas Newton <thomas.w.newton@gmail.com>
Comment thread flytekit/core/python_auto_container.py Outdated
# With empty attribute, it'll access the full image path (e.g. registry/imagename:version -> registry/imagename:version)
_IMAGE_REPLACE_REGEX = re.compile(r"({{\s*\.image[s]?(?:\.([a-zA-Z0-9_]+))(?:\.([a-zA-Z0-9_]+))?\s*}})", re.IGNORECASE)
_IMAGE_TEMPLATE_SUBSTRING_REGEX = r"(?:\.([a-zA-Z0-9_-]+))"
_IMAGE_REPLACE_REGEX = re.compile(f"({{{{\s*\.image[s]?{_IMAGE_TEMPLATE_SUBSTRING_REGEX}{_IMAGE_TEMPLATE_SUBSTRING_REGEX}?\s*}}}})", re.IGNORECASE)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Making this an f-string creates escaping complexity but IMO it was worthwhile to reduce some duplication.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.47%. Comparing base (c164f35) to head (a3a26d5).

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #3421       +/-   ##
===========================================
+ Coverage   45.78%   76.47%   +30.69%     
===========================================
  Files         317      217      -100     
  Lines       28359    22848     -5511     
  Branches     3015     3015               
===========================================
+ Hits        12983    17474     +4491     
+ Misses      15278     4559    -10719     
- Partials       98      815      +717     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Thomas Newton <thomas.w.newton@gmail.com>
@pingsutw pingsutw merged commit e0c3e23 into flyteorg:master Apr 10, 2026
56 checks passed
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.

2 participants