зеркало из https://github.com/microsoft/fabrikate.git
Add ability to bundle local chart in definition by omitting repo and just specifying path
This commit is contained in:
Родитель
2d4d25a167
Коммит
e31aee293e
|
@ -15,3 +15,4 @@ generated
|
|||
components
|
||||
releases
|
||||
helm_repos
|
||||
.DS_Store
|
||||
|
|
|
@ -43,7 +43,11 @@ func AddNamespaceToManifests(manifests string, namespace string) (namespacedMani
|
|||
}
|
||||
|
||||
func MakeHelmRepoPath(component *core.Component) string {
|
||||
return path.Join(component.PhysicalPath, "helm_repos", component.Name)
|
||||
if len(component.Repo) == 0 {
|
||||
return path.Join(component.PhysicalPath, component.Path)
|
||||
} else {
|
||||
return path.Join(component.PhysicalPath, "helm_repos", component.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func GenerateHelmComponent(component *core.Component) (manifest string, err error) {
|
||||
|
@ -87,6 +91,10 @@ func GenerateHelmComponent(component *core.Component) (manifest string, err erro
|
|||
}
|
||||
|
||||
func InstallHelmComponent(component *core.Component) (err error) {
|
||||
if len(component.Repo) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
helmRepoPath := MakeHelmRepoPath(component)
|
||||
if err := exec.Command("rm", "-rf", helmRepoPath).Run(); err != nil {
|
||||
return err
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package generators
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/Microsoft/fabrikate/core"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMakeHelmRepoPath(t *testing.T) {
|
||||
component := &core.Component{
|
||||
Name: "istio",
|
||||
Generator: "helm",
|
||||
Path: "./chart/istio-1.0.5",
|
||||
}
|
||||
|
||||
assert.Equal(t, MakeHelmRepoPath(component), "chart/istio-1.0.5")
|
||||
}
|
Загрузка…
Ссылка в новой задаче