cmd: plugged no-cache option to all relevant commands
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
parent
83f56897a7
commit
bbeff0eddb
@ -60,10 +60,10 @@ func GetCurrentDeploymentState(ctx context.Context, store *dagger.Store) *dagger
|
||||
}
|
||||
|
||||
// Re-compute a deployment (equivalent to `dagger up`).
|
||||
func DeploymentUp(ctx context.Context, state *dagger.DeploymentState) *dagger.Deployment {
|
||||
func DeploymentUp(ctx context.Context, state *dagger.DeploymentState, noCache bool) *dagger.Deployment {
|
||||
lg := log.Ctx(ctx)
|
||||
|
||||
c, err := dagger.NewClient(ctx, "")
|
||||
c, err := dagger.NewClient(ctx, "", noCache)
|
||||
if err != nil {
|
||||
lg.Fatal().Err(err).Msg("unable to create client")
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ var computeCmd = &cobra.Command{
|
||||
}
|
||||
}
|
||||
|
||||
deployment := common.DeploymentUp(ctx, st)
|
||||
deployment := common.DeploymentUp(ctx, st, viper.GetBool("no-cache"))
|
||||
|
||||
v := compiler.NewValue()
|
||||
if err := v.FillPath(cue.MakePath(), deployment.Plan()); err != nil {
|
||||
@ -173,6 +173,7 @@ func init() {
|
||||
computeCmd.Flags().StringSlice("input-git", []string{}, "TARGET=REMOTE#REF")
|
||||
computeCmd.Flags().String("input-json", "", "JSON")
|
||||
computeCmd.Flags().String("input-yaml", "", "YAML")
|
||||
computeCmd.Flags().Bool("no-cache", false, "disable cache")
|
||||
|
||||
if err := viper.BindPFlags(computeCmd.Flags()); err != nil {
|
||||
panic(err)
|
||||
|
@ -63,7 +63,7 @@ var newCmd = &cobra.Command{
|
||||
Msg("deployment created")
|
||||
|
||||
if viper.GetBool("up") {
|
||||
common.DeploymentUp(ctx, st)
|
||||
common.DeploymentUp(ctx, st, false)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ var queryCmd = &cobra.Command{
|
||||
cuePath = cue.ParsePath(args[0])
|
||||
}
|
||||
|
||||
c, err := dagger.NewClient(ctx, "")
|
||||
c, err := dagger.NewClient(ctx, "", false)
|
||||
if err != nil {
|
||||
lg.Fatal().Err(err).Msg("unable to create client")
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ var upCmd = &cobra.Command{
|
||||
state := common.GetCurrentDeploymentState(ctx, store)
|
||||
|
||||
// TODO: Implement options: --no-cache
|
||||
result := common.DeploymentUp(ctx, state)
|
||||
result := common.DeploymentUp(ctx, state, viper.GetBool("no-cache"))
|
||||
state.Computed = result.Computed().JSON().String()
|
||||
if err := store.UpdateDeployment(ctx, state, nil); err != nil {
|
||||
lg.Fatal().Err(err).Msg("failed to update deployment")
|
||||
@ -40,7 +40,7 @@ var upCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func init() {
|
||||
newCmd.Flags().Bool("--no-cache", false, "Disable all run cache")
|
||||
upCmd.Flags().Bool("no-cache", false, "Disable all run cache")
|
||||
|
||||
if err := viper.BindPFlags(upCmd.Flags()); err != nil {
|
||||
panic(err)
|
||||
|
Reference in New Issue
Block a user