MCPcopy
hub / github.com/helm/helm / NewForSource

Function NewForSource

internal/plugin/installer/installer.go:138–156  ·  view source on GitHub ↗

NewForSource determines the correct Installer for the given source.

(source, version string)

Source from the content-addressed store, hash-verified

136
137// NewForSource determines the correct Installer for the given source.
138func NewForSource(source, version string) (installer Installer, err error) {
139 if strings.HasPrefix(source, registry.OCIScheme+"://") {
140 // Source is an OCI registry reference
141 installer, err = NewOCIInstaller(source)
142 } else if isLocalReference(source) {
143 // Source is a local directory
144 installer, err = NewLocalInstaller(source)
145 } else if isRemoteHTTPArchive(source) {
146 installer, err = NewHTTPInstaller(source)
147 } else {
148 installer, err = NewVCSInstaller(source, version)
149 }
150
151 if err != nil {
152 return installer, fmt.Errorf("cannot get information about plugin source %q (if it's a local directory, does it exist?), last error was: %w", source, err)
153 }
154
155 return
156}
157
158// FindSource determines the correct Installer for the given source.
159func FindSource(location string) (Installer, error) {

Callers 10

newInstallerForSourceMethod · 0.92
TestVCSInstallerFunction · 0.85
TestVCSInstallerUpdateFunction · 0.85
TestLocalInstallerFunction · 0.85
TestHTTPInstallerFunction · 0.85
TestHTTPInstallerUpdateFunction · 0.85

Calls 6

NewOCIInstallerFunction · 0.85
isLocalReferenceFunction · 0.85
NewLocalInstallerFunction · 0.85
isRemoteHTTPArchiveFunction · 0.85
NewHTTPInstallerFunction · 0.85
NewVCSInstallerFunction · 0.85

Tested by 9

TestVCSInstallerFunction · 0.68
TestVCSInstallerUpdateFunction · 0.68
TestLocalInstallerFunction · 0.68
TestHTTPInstallerFunction · 0.68
TestHTTPInstallerUpdateFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…