Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project configuration (Pulumi.yaml) option to refresh before every preview/update/destroy #8058

Closed
infin8x opened this issue Sep 24, 2021 · 3 comments · Fixed by #8071
Closed
Assignees
Labels
customer/feedback Feedback from customers kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Milestone

Comments

@infin8x
Copy link
Contributor

infin8x commented Sep 24, 2021

Following up on a suggestion in #2247 (comment), let's introduce a new config option that will cause the engine to run a refresh before every preview/update/destroy operation. This should be logically equivalent to the user remembering to always add --refresh to those operations.

Suggested option name/type: alwaysRefresh (boolean)

@stack72
Copy link
Contributor

stack72 commented Sep 26, 2021

Hi @infin8x

So I need a little clarification on the work here - should the Pulumi.yaml option be used over the cli args? I.e. the user has specifically set this value for the entire project

Paul

@stack72 stack72 self-assigned this Sep 26, 2021
@stack72 stack72 added this to the 0.62 milestone Sep 26, 2021
@jre21
Copy link

jre21 commented Sep 26, 2021

Generally in this situation, command-line flags should take precedence over the config file. That way a user can set a default behavior but still override it for a specific execution. The most common approach I've seen in other projects is:

  • pulumi update --refresh: perform a refresh before updating
  • pulumi update --no-refresh: update without performing a refresh
  • pulumi update: use the behavior defined in the configuration file (or the global default if the config doesn't specify a behavior)

Another common pattern to keep in mind for if you do decide to change the default behavior in 4.0: many projects will issue a depreciation notice for a few releases prior to changing a default. This notice would typically be printed during program execution, state what behavior is changing, and direct users who wish to retain the current behavior to set it explicitly set it in their config file (usually with an additional note that doing so will silence the deprecation warning). The notice should not be displayed to users who already have an explicit setting in place, since they won't see a behavior change. Git took this approach, for example, prior to changing the default setting for push.default in their 2.0 release.

@infin8x
Copy link
Contributor Author

infin8x commented Sep 27, 2021

@stack72 good question. I agree with @jre21's suggestion - CLI flags take precedence over the config file.

Thanks @jre21 for the broader suggestion on deprecation workflow.

stack72 added a commit that referenced this issue Sep 27, 2021
Fixes: #8058

A user can now set `autoRefresh: true` in Pulumi.yaml to make all
derivative stacks to refresh by default when running an update, preview
or destroy command. We also introduce a new `--skip-refresh` variable
to be used in conjunction with the Pulumi.yaml update

the specific CLI commands still override this argument. Therefore:

* If a user sets autoRefresh: true, they can override this behaviour with `--skip-refresh`
* if a user sets `--refresh` then it will use that by default
* if no cli args are passed but `autoRefresh: true` then we will perform a refresh
* the default behaviour still exists of no refresh
stack72 added a commit that referenced this issue Sep 27, 2021
Fixes: #8058

A user can now set `autoRefresh: true` in Pulumi.yaml to make all
derivative stacks to refresh by default when running an update, preview
or destroy command. We also introduce a new `--skip-refresh` variable
to be used in conjunction with the Pulumi.yaml update

the specific CLI commands still override this argument. Therefore:

* If a user sets autoRefresh: true, they can override this behaviour with `--skip-refresh`
* if a user sets `--refresh` then it will use that by default
* if no cli args are passed but `autoRefresh: true` then we will perform a refresh
* the default behaviour still exists of no refresh
stack72 added a commit that referenced this issue Sep 28, 2021
Fixes: #8058

A user can now specify the following in their Pulumi.yaml

```
options:
  refresh: always
```

This will cause the derivative stacks to refresh by default when running an update, preview
or destroy command. We can override this with `--refresh=false`

the specific CLI commands still override this argument. Therefore:

* If a user sets refresh: always, they can override this behaviour with `--refresh==false`
* if a user sets `--refresh` or `--refresh=true` then it will use that by default
* if no cli args are passed but `refresh: always` then we will perform a refresh
* the default behaviour still exists of no refresh
stack72 added a commit that referenced this issue Sep 28, 2021
Fixes: #8058

A user can now specify the following in their Pulumi.yaml

```
options:
  refresh: always
```

This will cause the derivative stacks to refresh by default when running an update, preview
or destroy command. We can override this with `--refresh=false`

the specific CLI commands still override this argument. Therefore:

* If a user sets refresh: always, they can override this behaviour with `--refresh==false`
* if a user sets `--refresh` or `--refresh=true` then it will use that by default
* if no cli args are passed but `refresh: always` then we will perform a refresh
* the default behaviour still exists of no refresh
stack72 added a commit that referenced this issue Sep 28, 2021
Fixes: #8058

A user can now specify the following in their Pulumi.yaml

```
options:
  refresh: always
```

This will cause the derivative stacks to refresh by default when running an update, preview
or destroy command. We can override this with `--refresh=false`

the specific CLI commands still override this argument. Therefore:

* If a user sets refresh: always, they can override this behaviour with `--refresh==false`
* if a user sets `--refresh` or `--refresh=true` then it will use that by default
* if no cli args are passed but `refresh: always` then we will perform a refresh
* the default behaviour still exists of no refresh
stack72 added a commit that referenced this issue Sep 28, 2021
Fixes: #8058

A user can now specify the following in their Pulumi.yaml

```
options:
  refresh: always
```

This will cause the derivative stacks to refresh by default when running an update, preview
or destroy command. We can override this with `--refresh=false`

the specific CLI commands still override this argument. Therefore:

* If a user sets refresh: always, they can override this behaviour with `--refresh==false`
* if a user sets `--refresh` or `--refresh=true` then it will use that by default
* if no cli args are passed but `refresh: always` then we will perform a refresh
* the default behaviour still exists of no refresh
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer/feedback Feedback from customers kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants