diff --git a/cmd/cmd.go b/cmd/cmd.go index c0bb90d1..883da6a0 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -2,9 +2,9 @@ package cmd import ( "fmt" - "github.com/roboll/helmfile/helmexec" "github.com/roboll/helmfile/pkg/app" - "github.com/roboll/helmfile/state" + "github.com/roboll/helmfile/pkg/helmexec" + "github.com/roboll/helmfile/pkg/state" "github.com/urfave/cli" "go.uber.org/zap" "strings" diff --git a/cmd/deps.go b/cmd/deps.go index 6aac8427..ac40568d 100644 --- a/cmd/deps.go +++ b/cmd/deps.go @@ -1,10 +1,10 @@ package cmd import ( - "github.com/roboll/helmfile/args" - "github.com/roboll/helmfile/helmexec" "github.com/roboll/helmfile/pkg/app" - "github.com/roboll/helmfile/state" + "github.com/roboll/helmfile/pkg/argparser" + "github.com/roboll/helmfile/pkg/helmexec" + "github.com/roboll/helmfile/pkg/state" "github.com/urfave/cli" ) @@ -21,7 +21,7 @@ func Deps() cli.Command { }, Action: func(c *cli.Context) error { return VisitAllDesiredStates(c, func(state *state.HelmState, helm helmexec.Interface, ctx app.Context) (bool, []error) { - args := args.GetArgs(c.String("args"), state) + args := argparser.GetArgs(c.String("args"), state) if len(args) > 0 { helm.SetExtraArgs(args...) } diff --git a/main.go b/main.go index 2762d809..6952ba81 100644 --- a/main.go +++ b/main.go @@ -2,11 +2,11 @@ package main import ( "fmt" - "github.com/roboll/helmfile/args" "github.com/roboll/helmfile/cmd" - "github.com/roboll/helmfile/helmexec" "github.com/roboll/helmfile/pkg/app" - "github.com/roboll/helmfile/state" + "github.com/roboll/helmfile/pkg/argparser" + "github.com/roboll/helmfile/pkg/helmexec" + "github.com/roboll/helmfile/pkg/state" "github.com/urfave/cli" "go.uber.org/zap" "go.uber.org/zap/zapcore" @@ -107,7 +107,7 @@ func main() { }, Action: func(c *cli.Context) error { return cmd.VisitAllDesiredStates(c, func(state *state.HelmState, helm helmexec.Interface, ctx app.Context) (bool, []error) { - args := args.GetArgs(c.String("args"), state) + args := argparser.GetArgs(c.String("args"), state) if len(args) > 0 { helm.SetExtraArgs(args...) } @@ -264,7 +264,7 @@ func main() { Action: func(c *cli.Context) error { return findAndIterateOverDesiredStatesUsingFlags(c, func(state *state.HelmState, helm helmexec.Interface, ctx app.Context) []error { values := c.StringSlice("values") - args := args.GetArgs(c.String("args"), state) + args := argparser.GetArgs(c.String("args"), state) workers := c.Int("concurrency") if !c.Bool("skip-deps") { if errs := ctx.SyncReposOnce(state, helm); errs != nil && len(errs) > 0 { @@ -453,7 +453,7 @@ Do you really want to apply? return findAndIterateOverDesiredStatesUsingFlags(c, func(state *state.HelmState, helm helmexec.Interface, _ app.Context) []error { workers := c.Int("concurrency") - args := args.GetArgs(c.String("args"), state) + args := argparser.GetArgs(c.String("args"), state) if len(args) > 0 { helm.SetExtraArgs(args...) } @@ -481,7 +481,7 @@ Do you really want to apply? errs := cmd.FindAndIterateOverDesiredStatesUsingFlagsWithReverse(c, true, func(state *state.HelmState, helm helmexec.Interface, _ app.Context) []error { purge := c.Bool("purge") - args := args.GetArgs(c.String("args"), state) + args := argparser.GetArgs(c.String("args"), state) if len(args) > 0 { helm.SetExtraArgs(args...) } @@ -521,7 +521,7 @@ Do you really want to delete? Action: func(c *cli.Context) error { affectedReleases := state.AffectedReleases{} errs := cmd.FindAndIterateOverDesiredStatesUsingFlagsWithReverse(c, true, func(state *state.HelmState, helm helmexec.Interface, _ app.Context) []error { - args := args.GetArgs(c.String("args"), state) + args := argparser.GetArgs(c.String("args"), state) if len(args) > 0 { helm.SetExtraArgs(args...) } @@ -578,7 +578,7 @@ Do you really want to delete? timeout := c.Int("timeout") concurrency := c.Int("concurrency") - args := args.GetArgs(c.String("args"), state) + args := argparser.GetArgs(c.String("args"), state) if len(args) > 0 { helm.SetExtraArgs(args...) } @@ -597,7 +597,7 @@ Do you really want to delete? } func executeSyncCommand(c *cli.Context, affectedReleases *state.AffectedReleases, state *state.HelmState, helm helmexec.Interface) []error { - args := args.GetArgs(c.String("args"), state) + args := argparser.GetArgs(c.String("args"), state) if len(args) > 0 { helm.SetExtraArgs(args...) } @@ -609,7 +609,7 @@ func executeSyncCommand(c *cli.Context, affectedReleases *state.AffectedReleases } func executeTemplateCommand(c *cli.Context, state *state.HelmState, helm helmexec.Interface) []error { - args := args.GetArgs(c.String("args"), state) + args := argparser.GetArgs(c.String("args"), state) values := c.StringSlice("values") workers := c.Int("concurrency") @@ -617,7 +617,7 @@ func executeTemplateCommand(c *cli.Context, state *state.HelmState, helm helmexe } func executeDiffCommand(c *cli.Context, st *state.HelmState, helm helmexec.Interface, detailedExitCode, suppressSecrets bool) ([]*state.ReleaseSpec, []error) { - args := args.GetArgs(c.String("args"), st) + args := argparser.GetArgs(c.String("args"), st) if len(args) > 0 { helm.SetExtraArgs(args...) } diff --git a/pkg/app/app.go b/pkg/app/app.go index b0d7a9b1..610ab58b 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -2,6 +2,8 @@ package app import ( "fmt" + "github.com/roboll/helmfile/pkg/helmexec" + "github.com/roboll/helmfile/pkg/state" "io/ioutil" "log" "os" @@ -9,8 +11,6 @@ import ( "strings" "syscall" - "github.com/roboll/helmfile/helmexec" - "github.com/roboll/helmfile/state" "go.uber.org/zap" "path/filepath" diff --git a/pkg/app/app_test.go b/pkg/app/app_test.go index 5ab528db..b42728f2 100644 --- a/pkg/app/app_test.go +++ b/pkg/app/app_test.go @@ -2,13 +2,13 @@ package app import ( "fmt" + "github.com/roboll/helmfile/pkg/helmexec" + "github.com/roboll/helmfile/pkg/state" "os" "path/filepath" "reflect" "testing" - "github.com/roboll/helmfile/helmexec" - "github.com/roboll/helmfile/state" "gotest.tools/env" ) diff --git a/pkg/app/context.go b/pkg/app/context.go index 6ae381cd..1cfff7fb 100644 --- a/pkg/app/context.go +++ b/pkg/app/context.go @@ -1,6 +1,8 @@ package app -import "github.com/roboll/helmfile/state" +import ( + "github.com/roboll/helmfile/pkg/state" +) type Context struct { updatedRepos map[string]struct{} diff --git a/pkg/app/desired_state_file_loader.go b/pkg/app/desired_state_file_loader.go index 862cde35..e6cd8406 100644 --- a/pkg/app/desired_state_file_loader.go +++ b/pkg/app/desired_state_file_loader.go @@ -5,8 +5,8 @@ import ( "errors" "fmt" "github.com/imdario/mergo" - "github.com/roboll/helmfile/environment" - "github.com/roboll/helmfile/state" + "github.com/roboll/helmfile/pkg/environment" + "github.com/roboll/helmfile/pkg/state" "go.uber.org/zap" "path/filepath" "sort" diff --git a/pkg/app/two_pass_renderer.go b/pkg/app/two_pass_renderer.go index 015fc230..623a0961 100644 --- a/pkg/app/two_pass_renderer.go +++ b/pkg/app/two_pass_renderer.go @@ -3,9 +3,9 @@ package app import ( "bytes" "fmt" - "github.com/roboll/helmfile/environment" - "github.com/roboll/helmfile/state" - "github.com/roboll/helmfile/tmpl" + "github.com/roboll/helmfile/pkg/environment" + "github.com/roboll/helmfile/pkg/state" + "github.com/roboll/helmfile/pkg/tmpl" "strings" ) diff --git a/pkg/app/two_pass_renderer_test.go b/pkg/app/two_pass_renderer_test.go index 832d01bb..70167720 100644 --- a/pkg/app/two_pass_renderer_test.go +++ b/pkg/app/two_pass_renderer_test.go @@ -1,12 +1,12 @@ package app import ( + "github.com/roboll/helmfile/pkg/helmexec" + "github.com/roboll/helmfile/pkg/state" "os" "strings" "testing" - "github.com/roboll/helmfile/helmexec" - "github.com/roboll/helmfile/state" "gopkg.in/yaml.v2" ) diff --git a/args/args.go b/pkg/argparser/args.go similarity index 97% rename from args/args.go rename to pkg/argparser/args.go index 075351a0..3208eae0 100644 --- a/args/args.go +++ b/pkg/argparser/args.go @@ -1,10 +1,9 @@ -package args +package argparser import ( "fmt" + "github.com/roboll/helmfile/pkg/state" "strings" - - "github.com/roboll/helmfile/state" ) type keyVal struct { diff --git a/args/args_test.go b/pkg/argparser/args_test.go similarity index 96% rename from args/args_test.go rename to pkg/argparser/args_test.go index 5e51401d..adfadd63 100644 --- a/args/args_test.go +++ b/pkg/argparser/args_test.go @@ -1,10 +1,9 @@ -package args +package argparser import ( + "github.com/roboll/helmfile/pkg/state" "strings" "testing" - - "github.com/roboll/helmfile/state" ) func TestGetArgs(t *testing.T) { diff --git a/environment/environment.go b/pkg/environment/environment.go similarity index 100% rename from environment/environment.go rename to pkg/environment/environment.go diff --git a/event/bus.go b/pkg/event/bus.go similarity index 93% rename from event/bus.go rename to pkg/event/bus.go index ecff3632..aa6fe02e 100644 --- a/event/bus.go +++ b/pkg/event/bus.go @@ -2,9 +2,9 @@ package event import ( "fmt" - "github.com/roboll/helmfile/environment" - "github.com/roboll/helmfile/helmexec" - "github.com/roboll/helmfile/tmpl" + "github.com/roboll/helmfile/pkg/environment" + "github.com/roboll/helmfile/pkg/helmexec" + "github.com/roboll/helmfile/pkg/tmpl" "go.uber.org/zap" "os" ) diff --git a/event/bus_test.go b/pkg/event/bus_test.go similarity index 96% rename from event/bus_test.go rename to pkg/event/bus_test.go index 4a56fc54..a852d51c 100644 --- a/event/bus_test.go +++ b/pkg/event/bus_test.go @@ -2,8 +2,8 @@ package event import ( "fmt" - "github.com/roboll/helmfile/environment" - "github.com/roboll/helmfile/helmexec" + "github.com/roboll/helmfile/pkg/environment" + "github.com/roboll/helmfile/pkg/helmexec" "os" "testing" ) diff --git a/helmexec/context.go b/pkg/helmexec/context.go similarity index 100% rename from helmexec/context.go rename to pkg/helmexec/context.go diff --git a/helmexec/exec.go b/pkg/helmexec/exec.go similarity index 100% rename from helmexec/exec.go rename to pkg/helmexec/exec.go diff --git a/helmexec/exec_test.go b/pkg/helmexec/exec_test.go similarity index 100% rename from helmexec/exec_test.go rename to pkg/helmexec/exec_test.go diff --git a/helmexec/exit_error.go b/pkg/helmexec/exit_error.go similarity index 100% rename from helmexec/exit_error.go rename to pkg/helmexec/exit_error.go diff --git a/helmexec/helmexec.go b/pkg/helmexec/helmexec.go similarity index 100% rename from helmexec/helmexec.go rename to pkg/helmexec/helmexec.go diff --git a/helmexec/runner.go b/pkg/helmexec/runner.go similarity index 100% rename from helmexec/runner.go rename to pkg/helmexec/runner.go diff --git a/state/chart_dependency.go b/pkg/state/chart_dependency.go similarity index 99% rename from state/chart_dependency.go rename to pkg/state/chart_dependency.go index a9fe9cef..f731237c 100644 --- a/state/chart_dependency.go +++ b/pkg/state/chart_dependency.go @@ -3,7 +3,7 @@ package state import ( "fmt" "github.com/Masterminds/semver" - "github.com/roboll/helmfile/helmexec" + "github.com/roboll/helmfile/pkg/helmexec" "go.uber.org/zap" "gopkg.in/yaml.v2" "io/ioutil" diff --git a/state/create.go b/pkg/state/create.go similarity index 98% rename from state/create.go rename to pkg/state/create.go index b2f48457..9c4d42fa 100644 --- a/state/create.go +++ b/pkg/state/create.go @@ -5,8 +5,8 @@ import ( "errors" "fmt" "github.com/imdario/mergo" - "github.com/roboll/helmfile/environment" - "github.com/roboll/helmfile/helmexec" + "github.com/roboll/helmfile/pkg/environment" + "github.com/roboll/helmfile/pkg/helmexec" "go.uber.org/zap" "gopkg.in/yaml.v2" "io" diff --git a/state/create_test.go b/pkg/state/create_test.go similarity index 100% rename from state/create_test.go rename to pkg/state/create_test.go diff --git a/state/environment.go b/pkg/state/environment.go similarity index 100% rename from state/environment.go rename to pkg/state/environment.go diff --git a/state/environment_values_loader.go b/pkg/state/environment_values_loader.go similarity index 96% rename from state/environment_values_loader.go rename to pkg/state/environment_values_loader.go index cf16a18e..c02507f0 100644 --- a/state/environment_values_loader.go +++ b/pkg/state/environment_values_loader.go @@ -3,9 +3,9 @@ package state import ( "fmt" "github.com/imdario/mergo" - "github.com/roboll/helmfile/environment" + "github.com/roboll/helmfile/pkg/environment" "github.com/roboll/helmfile/pkg/maputil" - "github.com/roboll/helmfile/tmpl" + "github.com/roboll/helmfile/pkg/tmpl" "gopkg.in/yaml.v2" "path/filepath" ) diff --git a/state/release.go b/pkg/state/release.go similarity index 98% rename from state/release.go rename to pkg/state/release.go index 77273a26..6c9c2b61 100644 --- a/state/release.go +++ b/pkg/state/release.go @@ -2,7 +2,7 @@ package state import ( "fmt" - "github.com/roboll/helmfile/tmpl" + "github.com/roboll/helmfile/pkg/tmpl" "gopkg.in/yaml.v2" ) diff --git a/state/release_error.go b/pkg/state/release_error.go similarity index 95% rename from state/release_error.go rename to pkg/state/release_error.go index 809d4fcb..3cf849a7 100644 --- a/state/release_error.go +++ b/pkg/state/release_error.go @@ -1,6 +1,8 @@ package state -import "fmt" +import ( + "fmt" +) const ReleaseErrorCodeFailure = 1 diff --git a/state/release_filters.go b/pkg/state/release_filters.go similarity index 100% rename from state/release_filters.go rename to pkg/state/release_filters.go diff --git a/state/state.go b/pkg/state/state.go similarity index 99% rename from state/state.go rename to pkg/state/state.go index 080aa9ba..755032f5 100644 --- a/state/state.go +++ b/pkg/state/state.go @@ -3,6 +3,10 @@ package state import ( "errors" "fmt" + "github.com/roboll/helmfile/pkg/environment" + "github.com/roboll/helmfile/pkg/event" + "github.com/roboll/helmfile/pkg/helmexec" + "github.com/roboll/helmfile/pkg/tmpl" "io/ioutil" "os" "path" @@ -11,13 +15,8 @@ import ( "strconv" "strings" - "github.com/roboll/helmfile/helmexec" - "regexp" - "github.com/roboll/helmfile/environment" - "github.com/roboll/helmfile/event" - "github.com/roboll/helmfile/tmpl" "github.com/tatsushid/go-prettytable" "go.uber.org/zap" "gopkg.in/yaml.v2" diff --git a/state/state_exec_tmpl.go b/pkg/state/state_exec_tmpl.go similarity index 94% rename from state/state_exec_tmpl.go rename to pkg/state/state_exec_tmpl.go index 9b27c9b4..38164199 100644 --- a/state/state_exec_tmpl.go +++ b/pkg/state/state_exec_tmpl.go @@ -2,7 +2,7 @@ package state import ( "fmt" - "github.com/roboll/helmfile/tmpl" + "github.com/roboll/helmfile/pkg/tmpl" ) func (st *HelmState) envTemplateData() EnvironmentTemplateData { diff --git a/state/state_exec_tmpl_test.go b/pkg/state/state_exec_tmpl_test.go similarity index 97% rename from state/state_exec_tmpl_test.go rename to pkg/state/state_exec_tmpl_test.go index 51298142..220e6fb8 100644 --- a/state/state_exec_tmpl_test.go +++ b/pkg/state/state_exec_tmpl_test.go @@ -1,10 +1,9 @@ package state import ( + "github.com/roboll/helmfile/pkg/environment" "reflect" "testing" - - "github.com/roboll/helmfile/environment" ) func TestHelmState_executeTemplates(t *testing.T) { diff --git a/state/state_run.go b/pkg/state/state_run.go similarity index 97% rename from state/state_run.go rename to pkg/state/state_run.go index 8dac6037..d6617c80 100644 --- a/state/state_run.go +++ b/pkg/state/state_run.go @@ -2,7 +2,7 @@ package state import ( "fmt" - "github.com/roboll/helmfile/helmexec" + "github.com/roboll/helmfile/pkg/helmexec" "sync" ) diff --git a/state/state_test.go b/pkg/state/state_test.go similarity index 99% rename from state/state_test.go rename to pkg/state/state_test.go index 0a11dd70..24bc0a5c 100644 --- a/state/state_test.go +++ b/pkg/state/state_test.go @@ -1,6 +1,7 @@ package state import ( + "github.com/roboll/helmfile/pkg/helmexec" "io/ioutil" "os" "path/filepath" @@ -11,7 +12,6 @@ import ( "strings" "fmt" - "github.com/roboll/helmfile/helmexec" ) var logger = helmexec.NewLogger(os.Stdout, "warn") diff --git a/state/storage.go b/pkg/state/storage.go similarity index 100% rename from state/storage.go rename to pkg/state/storage.go diff --git a/state/testfs.go b/pkg/state/testfs.go similarity index 100% rename from state/testfs.go rename to pkg/state/testfs.go diff --git a/state/types.go b/pkg/state/types.go similarity index 94% rename from state/types.go rename to pkg/state/types.go index bf9dd019..e998a7ec 100644 --- a/state/types.go +++ b/pkg/state/types.go @@ -1,6 +1,8 @@ package state -import "github.com/roboll/helmfile/environment" +import ( + "github.com/roboll/helmfile/pkg/environment" +) // TemplateSpec defines the structure of a reusable and composable template for helm releases. type TemplateSpec struct { diff --git a/tmpl/context.go b/pkg/tmpl/context.go similarity index 100% rename from tmpl/context.go rename to pkg/tmpl/context.go diff --git a/tmpl/context_funcs.go b/pkg/tmpl/context_funcs.go similarity index 100% rename from tmpl/context_funcs.go rename to pkg/tmpl/context_funcs.go diff --git a/tmpl/context_funcs_test.go b/pkg/tmpl/context_funcs_test.go similarity index 100% rename from tmpl/context_funcs_test.go rename to pkg/tmpl/context_funcs_test.go diff --git a/tmpl/context_tmpl.go b/pkg/tmpl/context_tmpl.go similarity index 100% rename from tmpl/context_tmpl.go rename to pkg/tmpl/context_tmpl.go diff --git a/tmpl/context_tmpl_test.go b/pkg/tmpl/context_tmpl_test.go similarity index 100% rename from tmpl/context_tmpl_test.go rename to pkg/tmpl/context_tmpl_test.go diff --git a/tmpl/file_renderer.go b/pkg/tmpl/file_renderer.go similarity index 100% rename from tmpl/file_renderer.go rename to pkg/tmpl/file_renderer.go diff --git a/tmpl/file_renderer_test.go b/pkg/tmpl/file_renderer_test.go similarity index 97% rename from tmpl/file_renderer_test.go rename to pkg/tmpl/file_renderer_test.go index 51b0db8e..12d3e2ca 100644 --- a/tmpl/file_renderer_test.go +++ b/pkg/tmpl/file_renderer_test.go @@ -2,7 +2,7 @@ package tmpl import ( "fmt" - "github.com/roboll/helmfile/environment" + "github.com/roboll/helmfile/pkg/environment" "reflect" "testing" ) diff --git a/tmpl/get_or_nil.go b/pkg/tmpl/get_or_nil.go similarity index 100% rename from tmpl/get_or_nil.go rename to pkg/tmpl/get_or_nil.go diff --git a/tmpl/get_or_nil_test.go b/pkg/tmpl/get_or_nil_test.go similarity index 100% rename from tmpl/get_or_nil_test.go rename to pkg/tmpl/get_or_nil_test.go diff --git a/tmpl/text_renderer.go b/pkg/tmpl/text_renderer.go similarity index 100% rename from tmpl/text_renderer.go rename to pkg/tmpl/text_renderer.go