Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion internal/output/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (p *Printer) Handle(ev events.EngineEvent) {
switch d.Severity {
case "error", "warning", "info#err":
msg := strings.TrimSpace(d.Message)
if msg == "" {
if msg == "" || isKnownNoise(msg) {
return
}
if d.Severity == "error" && d.URN != "" {
Expand Down Expand Up @@ -276,6 +276,19 @@ func (p *Printer) Finish() {
_, _ = fmt.Fprintln(p.w, abortBanner)
}

// isKnownNoise drops diagnostics that carry no operator-actionable signal and
// repeat on EVERY remote command of EVERY deploy. Currently exactly one: the
// pulumi-command remote provider tries to pass PULUMI_COMMAND_STDOUT/STDERR as
// SSH env vars, OpenSSH's default AcceptEnv rejects them, and the provider
// warns — harmless (the vars only control the provider's own log forwarding;
// command stdout/stderr capture is unaffected) and unfixable from here short
// of loosening every host's sshd AcceptEnv for a cosmetic win. Keep this list
// SHORT and exact-prefix-matched: a suppression that grows becomes a place
// real warnings go to die.
func isKnownNoise(msg string) bool {
return strings.HasPrefix(msg, "Unable to set 'PULUMI_COMMAND_")
}

func firstLine(s string) string {
if i := strings.IndexByte(s, '\n'); i >= 0 {
return strings.TrimSpace(s[:i])
Expand Down
24 changes: 24 additions & 0 deletions internal/output/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,27 @@ func TestPrinterDestructiveAccessor(t *testing.T) {
t.Errorf("entry = %q", p.Destructive()[0])
}
}

// The pulumi-command remote provider warns about PULUMI_COMMAND_* SSH env vars
// on EVERY command of EVERY deploy — non-actionable noise that buried the real
// lines. It is suppressed; a real warning still prints.
func TestKnownNoiseWarningsAreSuppressed(t *testing.T) {
var buf bytes.Buffer
p := NewPrinter(&buf)
diag := func(sev, msg string) events.EngineEvent {
return events.EngineEvent{EngineEvent: apitype.EngineEvent{
DiagnosticEvent: &apitype.DiagnosticEvent{Severity: sev, Message: msg},
}}
}
p.Handle(diag("warning", "Unable to set 'PULUMI_COMMAND_STDERR'. This only works if your SSH server is configured to accept these variables via AcceptEnv."))
p.Handle(diag("warning", "Unable to set 'PULUMI_COMMAND_STDOUT'. This only works if your SSH server is configured to accept these variables via AcceptEnv."))
p.Handle(diag("warning", "a REAL warning about something else"))
p.Finish()
out := buf.String()
if strings.Contains(out, "PULUMI_COMMAND_") {
t.Errorf("the AcceptEnv provider noise must be suppressed:\n%s", out)
}
if !strings.Contains(out, "a REAL warning about something else") {
t.Errorf("real warnings must still print:\n%s", out)
}
}