1616package runneroptions
1717
1818import (
19- "context"
2019 "fmt"
2120 "strings"
2221)
@@ -27,7 +26,7 @@ const (
2726)
2827
2928// ImageResolveFunc is the type for a function that can resolve a partial image to a (more) fully-qualified name
30- type ImageResolveFunc func (ctx context. Context , image string ) ( string , error )
29+ type ImageResolveFunc func (image string ) string
3130
3231type RunnerOptions struct {
3332 // ImagePullPolicy controls the image pulling behavior before running the container.
@@ -62,24 +61,24 @@ type RunnerOptions struct {
6261
6362func (opts * RunnerOptions ) InitDefaults (defaultImagePrefix string ) {
6463 opts .ImagePullPolicy = IfNotPresentPull
65- opts .ResolveToImage = opts . ResolveToImageForCLIFunc (defaultImagePrefix )
64+ opts .ResolveToImage = ResolveToImageForCLIFunc (defaultImagePrefix )
6665}
6766
6867// ResolveToImageForCLIFunc returns a func that converts the KRM function short path to the full image url.
6968// If the function is a catalog function, it prepends `prefix`, e.g. "set-namespace:v0.1" --> prefix + "set-namespace:v0.1".
7069// A "/" is appended to `prefix` if it is not an empty string and does not end with a "/".
71- func ( opts * RunnerOptions ) ResolveToImageForCLIFunc (prefix string ) func (_ context. Context , image string ) ( string , error ) {
70+ func ResolveToImageForCLIFunc (prefix string ) func (image string ) string {
7271 prefix = strings .TrimSuffix (prefix , "/" )
7372 if prefix == "" {
74- return func (_ context. Context , image string ) ( string , error ) {
75- return image , nil
73+ return func (image string ) string {
74+ return image
7675 }
7776 }
78- return func (_ context. Context , image string ) ( string , error ) {
77+ return func (image string ) string {
7978 if ! strings .Contains (image , "/" ) {
80- return fmt .Sprintf ("%s/%s" , prefix , image ), nil
79+ return fmt .Sprintf ("%s/%s" , prefix , image )
8180 }
82- return image , nil
81+ return image
8382 }
8483}
8584
0 commit comments