Incrementally update the checkpoint file during pulumi update
.
Simply write the current snapshot after each step. We should probably be more clever about this in the future (i.e. write only the changes rather than the entire file).
This commit is contained in:
parent
ff2a3fa242
commit
11114bd243
|
@ -92,6 +92,7 @@ func (eng *Engine) deployLatest(info *envCmdInfo, opts deployOptions) error {
|
||||||
actions := &deployActions{
|
actions := &deployActions{
|
||||||
Ops: make(map[deploy.StepOp]int),
|
Ops: make(map[deploy.StepOp]int),
|
||||||
Opts: opts,
|
Opts: opts,
|
||||||
|
Target: result.Info.Target,
|
||||||
Engine: eng,
|
Engine: eng,
|
||||||
}
|
}
|
||||||
summary, _, _, err := result.Walk(actions)
|
summary, _, _, err := result.Walk(actions)
|
||||||
|
@ -115,10 +116,9 @@ func (eng *Engine) deployLatest(info *envCmdInfo, opts deployOptions) error {
|
||||||
colors.SpecAttention, colors.Reset))
|
colors.SpecAttention, colors.Reset))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now save the updated snapshot Notee that if a failure has occurred, the Apply routine above will
|
// Now save the updated snapshot Note that if a failure has occurred, the Apply routine above will
|
||||||
// have returned a safe checkpoint.
|
// have returned a safe checkpoint.
|
||||||
targ := result.Info.Target
|
_ = eng.Environment.SaveEnvironment(actions.Target, summary.Snap())
|
||||||
_ = eng.Environment.SaveEnvironment(targ, summary.Snap())
|
|
||||||
|
|
||||||
fmt.Fprint(eng.Stdout, colors.Colorize(&footer))
|
fmt.Fprint(eng.Stdout, colors.Colorize(&footer))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -139,6 +139,7 @@ type deployActions struct {
|
||||||
Ops map[deploy.StepOp]int
|
Ops map[deploy.StepOp]int
|
||||||
MaybeCorrupt bool
|
MaybeCorrupt bool
|
||||||
Opts deployOptions
|
Opts deployOptions
|
||||||
|
Target *deploy.Target
|
||||||
Engine *Engine
|
Engine *Engine
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,4 +193,8 @@ func (acts *deployActions) After(step deploy.Step, status resource.Status, err e
|
||||||
fmt.Fprint(acts.Engine.Stdout, colors.Colorize(&b))
|
fmt.Fprint(acts.Engine.Stdout, colors.Colorize(&b))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write out the current snapshot. Note that even if a failure has occurred, we should still have
|
||||||
|
// a safe checkpoint.
|
||||||
|
_ = acts.Engine.Environment.SaveEnvironment(acts.Target, step.Iterator().Snap())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue