Reads should not cause resources to be displayed in our progress display (#2844)

This commit is contained in:
CyrusNajmabadi 2019-06-18 15:38:32 -07:00 committed by GitHub
parent eb3a7d0a7a
commit ef3cad6bf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 2 deletions

View file

@ -1,15 +1,22 @@
## 0.17.18 (Unreleased)
- Allow setting backend URL explicitly in `Pulumi.yaml` file
- `StackReference` now has a `.getOutputSync` function to retrieve exported values from an existing
stack synchronously. This can be valuable when creating another stack that wants to base
flow-control off of the values of an existing stack (i.e. importing the information about all AZs
and basing logic off of that in a new stack). Note: this only works for importing values from
Stacks that have not exported `secrets`.
- When the environment variaible `PULUMI_TEST_MODE` is set to `true`, the
Python runtime will now behave as if
`pulumi.runtime.settings._set_test_mode_enabled(True)` had been called. This
mirrors the behavior for NodeJS programs (fixes [#2818](https://github.com/pulumi/pulumi/issues/2818)).
mirrors the behavior for NodeJS programs (fixes [#2818](https://github.com/pulumi/pulumi/issues/2818)).
- Resources that are only 'read' will no longer be displayed in the terminal tree-display anymore.
These ended up heavily cluttering the display and often meant that programs without updates still
showed a bunch of resources that weren't important. There will still be a message displayed
indicating that a 'read' has happened to help know that these are going on and that the program is making progress.
## 0.17.17 (Released June 12, 2019)

View file

@ -153,7 +153,14 @@ func renderSummaryEvent(action apitype.UpdateKind, event engine.SummaryEventPayl
// Now summarize all of the changes; we print sames a little differently.
for _, op := range deploy.StepOps {
if op != deploy.OpSame {
// Ignore anything that didn't change, or is related to 'reads'. 'reads' are just an
// indication of the operations we were performing, and are not indicative of any sort of
// change to the system.
if op != deploy.OpSame &&
op != deploy.OpRead &&
op != deploy.OpReadDiscard &&
op != deploy.OpReadReplacement {
if c := changes[op]; c > 0 {
opDescription := string(op)
if !event.IsPreview {

View file

@ -879,6 +879,32 @@ func (display *ProgressDisplay) processNormalEvent(event engine.Event) {
// At this point, all events should relate to resources.
eventUrn, metadata := getEventUrnAndMetadata(event)
if metadata != nil {
if metadata.Op == deploy.OpReadDiscard || metadata.Op == deploy.OpReadReplacement {
// just flat out ignore read discards/replace. They're only relevant in the context of
// 'reads', and we only present reads as an ephemeral diagnostic anyways.
return
}
if metadata.Op == deploy.OpRead {
// Don't show reads as operations on a specific resource. It's an underlying detail
// that we don't want to clutter up the display with. However, to help users know
// what's going on, we can show them as ephemeral diagnostic messages that are
// associated at the top level with the stack. That way if things are taking a while,
// there's insight in the display as to what's going on.
display.processNormalEvent(engine.Event{
Type: engine.DiagEvent,
Payload: engine.DiagEventPayload{
Ephemeral: true,
Severity: diag.Info,
Color: cmdutil.GetGlobalColorization(),
Message: fmt.Sprintf("read %v %v", simplifyTypeName(eventUrn.Type()), eventUrn.Name()),
},
})
return
}
}
if eventUrn == "" {
// If this event has no URN, associate it with the stack. Note that there may not yet be a stack resource, in
// which case this is a no-op.

View file

@ -282,6 +282,13 @@ func (data *resourceRowData) IsDone() bool {
return true
}
if isRootStack(data.step) {
// the root stack only becomes 'done' once the program has completed (i.e. the condition
// checked just above this). If the program is not finished, then always show the root
// stack as not done so the user sees "running..." presented for it.
return false
}
// We're done if we have the output-step for whatever step operation we're performing
return data.ContainsOutputsStep(data.step.Op)
}