mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
fix(plugins): support installing plugins by relative path (#3568)
Support installing plugins by relative path ``` helm plugins install . ```
This commit is contained in:
parent
c314e2e2f1
commit
fa611fe285
2 changed files with 8 additions and 7 deletions
|
|
@ -21,9 +21,9 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"k8s.io/helm/pkg/helm/helmpath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ErrMissingMetadata indicates that plugin.yaml is missing.
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||
package installer // import "k8s.io/helm/pkg/plugin/installer"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"k8s.io/helm/pkg/helm/helmpath"
|
||||
|
|
@ -28,8 +29,12 @@ type LocalInstaller struct {
|
|||
|
||||
// NewLocalInstaller creates a new LocalInstaller.
|
||||
func NewLocalInstaller(source string, home helmpath.Home) (*LocalInstaller, error) {
|
||||
src, err := filepath.Abs(source)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to get absolute path to plugin: %v", err)
|
||||
}
|
||||
i := &LocalInstaller{
|
||||
base: newBase(source, home),
|
||||
base: newBase(src, home),
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
|
@ -41,11 +46,7 @@ func (i *LocalInstaller) Install() error {
|
|||
if !isPlugin(i.Source) {
|
||||
return ErrMissingMetadata
|
||||
}
|
||||
src, err := filepath.Abs(i.Source)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return i.link(src)
|
||||
return i.link(i.Source)
|
||||
}
|
||||
|
||||
// Update updates a local repository
|
||||
|
|
|
|||
Loading…
Reference in a new issue