Skip to content

Create a central image utility package - #1103

Merged
liamfallon merged 10 commits into
kptdev:mainfrom
nokia:image-utils
Jul 20, 2026
Merged

Create a central image utility package#1103
liamfallon merged 10 commits into
kptdev:mainfrom
nokia:image-utils

Conversation

@mozesl-nokia

@mozesl-nokia mozesl-nokia commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Create a central image utility package

Originally part of #1019


Description

  • What changed: Added a new go package under pkg/util/image
  • Why it’s needed: So we don't have different, fragmented handling of OCI image name parsing
  • How it works: Parsing logic based on distribution and regclient, with some regex taken from the latter

Related Issue(s)


Type of Change

  • Enhancement
  • Refactor

Checklist

  • Code follows project style guidelines
  • Self-reviewed changes
  • Tests added/updated
  • Documentation added/updated
  • All tests and gating checks pass

Additional Notes (Optional)

  • Further improvements: Wrap or use distribution/reference types and google/go-containerregistry/name types

AI Disclosure

  • I have used AI in the creation of this PR.

If so, please describe how:

  • Cursor's composer 2.5 was used to review the changes and write the unit test

Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Assisted-by: Cursor:composer-2.5
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
@mozesl-nokia
mozesl-nokia requested review from a team July 6, 2026 08:33
@mozesl-nokia mozesl-nokia added go Pull requests that update go code refactoring #b33d8f labels Jul 6, 2026
@netlify

netlify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Deploy Preview for kpt-porch ready!

Name Link
🔨 Latest commit 3152f20
🔍 Latest deploy log https://app.netlify.com/projects/kpt-porch/deploys/6a579eb20fc58e000839bd53
😎 Deploy Preview https://deploy-preview-1103--kpt-porch.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 6, 2026
@github-actions
github-actions Bot requested a review from Copilot July 6, 2026 08:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a centralized Go utility package for OCI image reference handling and migrates existing image parsing/joining/semver-selection call sites to use it, reducing duplicated and inconsistent parsing logic across the codebase.

Changes:

  • Added pkg/util/image with Parse, Join, and FindBestSemverMatch, plus unit tests.
  • Removed legacy image helpers and semver matching from pkg/util/util.go (and corresponding tests).
  • Updated engine/runtime and function executor/controller code paths to use the new image utility.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/util/util.go Removes legacy semver and image string helpers in favor of the new package.
pkg/util/util_test.go Removes tests that covered the deleted semver helper.
pkg/util/image/types.go Adds ParsedImage struct and helpers to reconstruct/present parsed references.
pkg/util/image/regex.go Adds registry-detection regex (sourced from regclient) used by parsing logic.
pkg/util/image/image.go Implements semver tag selection, join helper, and reference parsing.
pkg/util/image/image_test.go Adds unit tests for semver selection and parsing behavior.
pkg/engine/builtinruntime.go Switches builtin runner logic to use the new parsing + semver utilities.
pkg/engine/builtinruntime_test.go Updates tests to use new join helper and adjusts logging expectations.
func/internal/podcachemanager.go Switches function keying/joining to new parsing/join utilities.
func/internal/executableevaluator.go Adjusts logging verbosity for explicit-tag execution path.
func/internal/executableevaluator_test.go Updates join usage, log assertions, and ensures klog verbosity in tests.
controllers/functionconfigs/reconciler/functionconfigreconciler.go Refactors cache lookups to use parsed image components and new semver helper.

Comment thread pkg/util/image/types.go
Comment thread controllers/functionconfigs/reconciler/functionconfigreconciler.go Outdated
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Assisted-by: Cursor:composer-2.5
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
liamfallon
liamfallon previously approved these changes Jul 8, 2026
@dosubot dosubot Bot added the lgtm #ededed label Jul 8, 2026
@sonarqubecloud

Copy link
Copy Markdown

@mozesl-nokia
mozesl-nokia requested review from a team July 17, 2026 12:40
@liamfallon
liamfallon merged commit de5e393 into kptdev:main Jul 20, 2026
30 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update go code lgtm #ededed refactoring #b33d8f size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants