Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions image_substitutors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ func TestPrependHubRegistrySubstitutor(t *testing.T) {

require.Equalf(t, "my-registry/org/user/foo:latest", img, "expected my-registry/org/foo:latest, got %s", img)
})

t.Run("registry with port", func(t *testing.T) {
Comment thread
fedorkanin marked this conversation as resolved.
Outdated
s := newPrependHubRegistry("my-registry:5000")

img, err := s.Substitute("foo:latest")
require.NoError(t, err)
require.Equalf(t, "my-registry:5000/foo:latest", img, "expected my-registry:5000/foo:latest, got %s", img)
})
})

t.Run("should not prepend the hub registry to the image name", func(t *testing.T) {
Expand Down
16 changes: 3 additions & 13 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"fmt"
"maps"
"net/url"
"path"
"time"

"dario.cat/mergo"
Expand Down Expand Up @@ -196,12 +196,7 @@ func (c CustomHubSubstitutor) Substitute(image string) (string, error) {
}
}

result, err := url.JoinPath(c.hub, image)
if err != nil {
return "", err
}

return result, nil
return path.Join(c.hub, image), nil
}

// prependHubRegistry represents a way to prepend a custom Hub registry to the image name,
Expand Down Expand Up @@ -244,12 +239,7 @@ func (p prependHubRegistry) Substitute(image string) (string, error) {
}
}

result, err := url.JoinPath(p.prefix, image)
if err != nil {
return "", err
}

return result, nil
return path.Join(p.prefix, image), nil
}

// WithImageSubstitutors sets the image substitutors for a container
Expand Down
Loading