pulumi/pkg/backend/display/options.go

70 lines
3.2 KiB
Go
Raw Normal View History

2018-05-22 19:43:36 +00:00
// Copyright 2016-2018, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package display
import (
"io"
"github.com/pulumi/pulumi/pkg/v3/backend/display/internal/terminal"
"github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors"
)
// Type of output to display.
type Type int
const (
// DisplayProgress displays an update as it progresses.
DisplayProgress Type = iota
// DisplayDiff displays a rich diff.
DisplayDiff
// DisplayQuery displays query output.
DisplayQuery
2021-09-20 16:42:29 +00:00
// DisplayWatch displays watch output.
DisplayWatch
)
// Options controls how the output of events are rendered
type Options struct {
Color colors.Colorization // colorization to apply to events.
ShowConfig bool // true if we should show configuration information.
ShowPolicyRemediations bool // true if we should show detailed policy remediations.
ShowReplacementSteps bool // true to show the replacement steps in the plan.
ShowSameResources bool // true to show the resources that aren't updated in addition to updates.
ShowReads bool // true to show resources that are being read in
TruncateOutput bool // true if we should truncate long outputs
SuppressOutputs bool // true to suppress output summarization, e.g. if contains sensitive info.
SuppressPermalink bool // true to suppress state permalink
SummaryDiff bool // true if diff display should be summarized.
IsInteractive bool // true if we should display things interactively.
Type Type // type of display (rich diff, progress, or query).
JSONDisplay bool // true if we should emit the entire diff as JSON.
EventLogPath string // the path to the file to use for logging events, if any.
Debug bool // true to enable debug output.
Stdin io.Reader // the reader to use for stdin. Defaults to os.Stdin if unset.
Stdout io.Writer // the writer to use for stdout. Defaults to os.Stdout if unset.
Stderr io.Writer // the writer to use for stderr. Defaults to os.Stderr if unset.
SuppressTimings bool // true to suppress displaying timings of resource actions
SuppressProgress bool // true to suppress displaying progress spinner.
// testing-only options
term terminal.Terminal
Add display to the engine tests (#16050) We want to add more test coverage to the display code. The best way to do that is to add it to the engine tests, that already cover most of the pulumi functionality. It's probably not really possible to review all of the output, but at least it gives us a baseline, which we can work with. There's a couple of tests that are flaky for reasons I don't quite understand yet. I marked them as to skip and we can look at them later. I'd rather get in the baseline tests sooner, rather than spending a bunch of time looking at that. The output differences also seem very minor, so not super concerning. The biggest remaining issue is that this doesn't interact well with the Chdir we're doing in the engine. We could either pass the CWD through, or just try to get rid of that Chdir. So this should only be merged after https://github.com/pulumi/pulumi/pull/15607. I've tried to split this into a few commits, separating out adding the testdata, so it's hopefully a little easier to review, even though the PR is still quite large. One other thing to note is that we're comparing that the output has all the same lines, and not that it is exactly the same. Because of how the engine is implemented, there's a bunch of race conditions otherwise, that would make us have to skip a bunch of tests, just because e.g. resource A is sometimes deleted before resource B and sometimes it's the other way around. The biggest downside of that is that running with `PULUMI_ACCEPT` will produce a diff even when there are no changes. Hopefully we won't have to run that way too often though, so it might not be a huge issue? --------- Co-authored-by: Fraser Waters <fraser@pulumi.com>
2024-05-13 07:18:25 +00:00
DeterministicOutput bool
}
`pulumi new` with existing project now can be bypassed (#14081) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> Fixes #13832 [asciinema recording](https://asciinema.org/a/zZvO66E31sMZ0t2DCAbnuMUMW) ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-10-20 15:43:29 +00:00
func (opts Options) WithIsInteractive(isInteractive bool) Options {
opts.IsInteractive = isInteractive
return opts
}