cmd/common: restored no-cache behavior

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-07-12 14:26:55 +02:00
parent 2b9e74db45
commit 9473d54bfb
10 changed files with 11 additions and 11 deletions

View File

@ -161,10 +161,10 @@ func ValueDocOneLine(val *compiler.Value) string {
} }
// NewClient creates a new client // NewClient creates a new client
func NewClient(ctx context.Context) *client.Client { func NewClient(ctx context.Context, noCache bool) *client.Client {
lg := log.Ctx(ctx) lg := log.Ctx(ctx)
cl, err := client.New(ctx, "", false) cl, err := client.New(ctx, "", noCache)
if err != nil { if err != nil {
lg.Fatal().Err(err).Msg("unable to create client") lg.Fatal().Err(err).Msg("unable to create client")
} }

View File

@ -70,7 +70,7 @@ var editCmd = &cobra.Command{
st.Plan = newState.Plan st.Plan = newState.Plan
st.Inputs = newState.Inputs st.Inputs = newState.Inputs
cl := common.NewClient(ctx) cl := common.NewClient(ctx, false)
_, err = cl.Do(ctx, st, func(ctx context.Context, env *environment.Environment, s solver.Solver) error { _, err = cl.Do(ctx, st, func(ctx context.Context, env *environment.Environment, s solver.Solver) error {
// check for cue errors by scanning all the inputs // check for cue errors by scanning all the inputs
_, err := env.ScanInputs(ctx, true) _, err := env.ScanInputs(ctx, true)

View File

@ -23,7 +23,7 @@ var containerCmd = &cobra.Command{
lg := logger.New() lg := logger.New()
ctx := lg.WithContext(cmd.Context()) ctx := lg.WithContext(cmd.Context())
updateEnvironmentInput(ctx, common.NewClient(ctx), args[0], state.DockerInput(args[1])) updateEnvironmentInput(ctx, common.NewClient(ctx, false), args[0], state.DockerInput(args[1]))
}, },
} }

View File

@ -43,7 +43,7 @@ var dirCmd = &cobra.Command{
p = "./" + p p = "./" + p
} }
updateEnvironmentInput(ctx, common.NewClient(ctx), args[0], updateEnvironmentInput(ctx, common.NewClient(ctx, false), args[0],
state.DirInput( state.DirInput(
p, p,
viper.GetStringSlice("include"), viper.GetStringSlice("include"),

View File

@ -33,7 +33,7 @@ var gitCmd = &cobra.Command{
subDir = args[3] subDir = args[3]
} }
updateEnvironmentInput(ctx, common.NewClient(ctx), args[0], state.GitInput(args[1], ref, subDir)) updateEnvironmentInput(ctx, common.NewClient(ctx, false), args[0], state.GitInput(args[1], ref, subDir))
}, },
} }

View File

@ -25,7 +25,7 @@ var jsonCmd = &cobra.Command{
updateEnvironmentInput( updateEnvironmentInput(
ctx, ctx,
common.NewClient(ctx), common.NewClient(ctx, false),
args[0], args[0],
state.JSONInput(readInput(ctx, args[1])), state.JSONInput(readInput(ctx, args[1])),
) )

View File

@ -44,7 +44,7 @@ var secretCmd = &cobra.Command{
updateEnvironmentInput( updateEnvironmentInput(
ctx, ctx,
common.NewClient(ctx), common.NewClient(ctx, false),
args[0], args[0],
state.SecretInput(secret), state.SecretInput(secret),
) )

View File

@ -25,7 +25,7 @@ var textCmd = &cobra.Command{
updateEnvironmentInput( updateEnvironmentInput(
ctx, ctx,
common.NewClient(ctx), common.NewClient(ctx, false),
args[0], args[0],
state.TextInput(readInput(ctx, args[1])), state.TextInput(readInput(ctx, args[1])),
) )

View File

@ -25,7 +25,7 @@ var yamlCmd = &cobra.Command{
updateEnvironmentInput( updateEnvironmentInput(
ctx, ctx,
common.NewClient(ctx), common.NewClient(ctx, false),
args[0], args[0],
state.YAMLInput(readInput(ctx, args[1])), state.YAMLInput(readInput(ctx, args[1])),
) )

View File

@ -38,7 +38,7 @@ var upCmd = &cobra.Command{
workspace := common.CurrentWorkspace(ctx) workspace := common.CurrentWorkspace(ctx)
st := common.CurrentEnvironmentState(ctx, workspace) st := common.CurrentEnvironmentState(ctx, workspace)
cl := common.NewClient(ctx) cl := common.NewClient(ctx, viper.GetBool("no-cache"))
// check that all inputs are set // check that all inputs are set
checkInputs(ctx, cl, st) checkInputs(ctx, cl, st)