feat: show live output from the Helm binary (#286)

* feat: show live output from the Helm binary

Signed-off-by: Rodrigo Fior Kuntzer <rodrigo@miro.com>

* fixup! Merge branch 'main' into enable-live-output

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
Rodrigo Fior Kuntzer
2022-09-18 14:24:35 +09:00
committed by GitHub
parent c828d22a5c
commit 8408b021f0
22 changed files with 338 additions and 61 deletions
+4 -1
View File
@@ -55,10 +55,12 @@ type StateCreator struct {
overrideHelmBinary string
enableLiveOutput bool
remote *remote.Remote
}
func NewCreator(logger *zap.SugaredLogger, fs *filesystem.FileSystem, valsRuntime vals.Evaluator, getHelm func(*HelmState) helmexec.Interface, overrideHelmBinary string, remote *remote.Remote) *StateCreator {
func NewCreator(logger *zap.SugaredLogger, fs *filesystem.FileSystem, valsRuntime vals.Evaluator, getHelm func(*HelmState) helmexec.Interface, overrideHelmBinary string, remote *remote.Remote, enableLiveOutput bool) *StateCreator {
return &StateCreator{
logger: logger,
@@ -68,6 +70,7 @@ func NewCreator(logger *zap.SugaredLogger, fs *filesystem.FileSystem, valsRuntim
getHelm: getHelm,
overrideHelmBinary: overrideHelmBinary,
enableLiveOutput: enableLiveOutput,
remote: remote,
}
+7 -3
View File
@@ -65,6 +65,10 @@ type stateTestEnv struct {
}
func (testEnv stateTestEnv) MustLoadState(t *testing.T, file, envName string) *HelmState {
return testEnv.MustLoadStateWithEnableLiveOutput(t, file, envName, false)
}
func (testEnv stateTestEnv) MustLoadStateWithEnableLiveOutput(t *testing.T, file, envName string, enableLiveOutput bool) *HelmState {
t.Helper()
testFs := testhelper.NewTestFs(testEnv.Files)
@@ -79,7 +83,7 @@ func (testEnv stateTestEnv) MustLoadState(t *testing.T, file, envName string) *H
}
r := remote.NewRemote(logger, testFs.Cwd, testFs.ToFileSystem())
state, err := NewCreator(logger, testFs.ToFileSystem(), nil, nil, "", r).
state, err := NewCreator(logger, testFs.ToFileSystem(), nil, nil, "", r, enableLiveOutput).
ParseAndLoad([]byte(yamlContent), filepath.Dir(file), file, envName, true, nil)
if err != nil {
t.Fatalf("unexpected error: %v", err)
@@ -149,7 +153,7 @@ releaseNamespace: mynamespace
env := environment.Environment{
Name: "production",
}
state, err := NewCreator(logger, testFs.ToFileSystem(), nil, nil, "", r).
state, err := NewCreator(logger, testFs.ToFileSystem(), nil, nil, "", r, false).
ParseAndLoad(yamlContent, filepath.Dir(yamlFile), yamlFile, "production", true, &env)
if err != nil {
t.Fatalf("unexpected error: %v", err)
@@ -236,7 +240,7 @@ overrideNamespace: myns
testFs.Cwd = "/example/path/to"
r := remote.NewRemote(logger, testFs.Cwd, testFs.ToFileSystem())
state, err := NewCreator(logger, testFs.ToFileSystem(), nil, nil, "", r).
state, err := NewCreator(logger, testFs.ToFileSystem(), nil, nil, "", r, false).
ParseAndLoad(yamlContent, filepath.Dir(yamlFile), yamlFile, "production", true, nil)
if err != nil {
t.Fatalf("unexpected error: %v", err)