Commit Graph

216 Commits

Author SHA1 Message Date
Will Jones 1be4888f7d
Replace `result.Result` with native errors ()
`result.Result` is a type that was introduced to enable us to
distinguish between *expected* errors (or *bails* in Pulumi parlance)
and *unexpected* errors or exceptions. Prior to Go 1.13, this made a lot
of sense, since there was no standard story on "wrapping" errors, and
thus no way to answer the question "did I end up here (in an error path)
because I meant to, or did I end up here because of a program bug?".

With the introduction of `%w`, `interface { Unwrap() []error }` and
company in Go 1.13, a simpler interface is available: one can use
`errors.Is` and `errors.As` to ask if an error at any point wraps an
error of a certain type. With this, we can simply ask "is there a bail
at any point in this error tree?" rather than having to track this
explicitly using a type such as `result.Result`. The `IsBail` function
was introduced a while ago to this end, but its rollout was not
completed and several uses of `result.Result` remained.

This commit completes the rollout of this simplified interface,
replacing all uses of `result.Result` with native Go errors that may or
may not wrap bails, and all uses of e.g. `res.IsBail` with
`IsBail(err)`. Doing so allows us to remove `result.Result` entirely.
2024-08-22 14:39:59 +00:00
Thomas Gummerer 76abb5c14c
prefer environment over config for PULUMI_ACCESS_TOKEN ()
The common order of priority for configuration is (in descending order
of priority):
- command line flags
- environment variables
- configuration

When a user uses the `PULUMI_ACCESS_TOKEN` environment variable, we also
currently save this to a configuration file. While it could be
considered somewhat questionable writing the secret in the environment
variable to disk in the first place, it is somewhat likely that users
rely on that behaviour and we don't want to change that.

However it is also very confusing to users that if they change the
`PULUMI_ACCESS_TOKEN` environment variable that we still keep re-using
the access token that is already stored in the configuration. It could
potentially be considered a breaking to prefer the `PULUMI_ACCESS_TOKEN`
variable over the access token set in the configuration. However setting
the `PULUMI_ACCESS_TOKEN` to something different is an explicit action,
and users are very unlikely to expect the token from the configuration
file to be used at this point.

Make the configuration in the environment variable the priority to be
less surprising to users.

Fixes https://github.com/pulumi/pulumi/issues/5293
Fixes https://github.com/pulumi/pulumi/issues/13919 (cc @ringods, not
sure if we can declare this issue fixed? We still write the access token
to disk because I'm worried about backwards compatibility if we don't.
Happy to keep this issue open if you prefer)
2024-08-14 08:46:58 +00:00
Germán Lena a7d5e238b8
New deployment settings wizards and environment variables management comands ()
- Turns `deployment settings init` command a wizard
- Adds new `deployment settings env` command to manage env variables
(including secrets encryption)
- Adds new `deployment settings set` command to configure individual
settings (including secrets encryption)

https://asciinema.org/a/QhuWHAvkmeAmVJkYqkCP0P6wb

Fix https://github.com/pulumi/pulumi-service/issues/20567
Fix https://github.com/pulumi/pulumi-service/issues/20576
2024-07-03 20:24:26 +00:00
Germán Lena a0b67cda05
Update pu/pu to support deployment run command ()
<!--- 
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

Add new deployment run command

Fixes https://github.com/pulumi/pulumi-service/issues/20500

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] 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. -->
2024-07-01 14:18:44 +00:00
Germán Lena 87a184a381
Update pu/pu to support new Deployment Settings endpoints ()
<!--- 
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

Add DS endpoints to the backend and client

Fixes https://github.com/pulumi/pulumi-service/issues/20276

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] 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. -->
2024-06-13 19:49:49 +00:00
Mikhail Shilkov 96780a6d84
Refine the error message when a full stack name is not supplied ()
<!--- 
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

Refine the error message when a full stack name is not supplied outside
a project directory

Context:

1. Open a brand-new clean directory that is not a child directory to any
Pulumi program.
2. Run `pulumi stack init dev`
3. CLI doesn't have a project name at this point, because it has not
Pulumi.yaml. So, the user needs to supply the full name.

Fixes https://github.com/pulumi/pulumi/issues/15967

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] 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. -->
2024-06-03 16:38:25 +00:00
Will Jones a2b227695c
Report snapshot write errors as actual errors ()
When we finish an operation and close the snapshot manager, the snapshot
manager may perform a final write if there are unflushed changes (e.g.
refresh changes whose writes were elided at the time). Things may go
wrong at this point -- if something is wrong with the snapshot, the
integrity check following this write could fail; if a write error
occurs, pieces of the snapshot may be missing. In these cases, we really
don't want to swallow the error or report it as "just" a diagnostic,
because it's a real problem that will almost certainly rear its head on
the next Pulumi invocation when we attempt (and fail) to read the
snapshot (or worse, operate with an incomplete one). This commit changes
the existing flow to report all snapshot close errors as bonafide
failures, even if the actual operation has succeeded and been applied.
2024-04-30 17:23:18 +00:00
Mikhail Shilkov fb20b6d78b
Change the link to Stack References docs ()
<!--- 
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

Replace the link that we print to point to stack references docs. The
old link is for `pulumi.io` that isn't used anywhere else,
and also I think it goes to a wrong page and non-existing anchor.

[The
page](https://github.com/pulumi/pulumi-hugo/blob/master/themes/default/content/docs/using-pulumi/stack-outputs-and-references/index.md?plain=1)
doesn't seem to have a short link defined.

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] 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. -->
2024-04-19 14:23:13 +00:00
Fraser Waters b610557f5a
Fix warning about Snapshot write failed for previews ()
This stops the CLI warning about `error: Snapshot write failed: failed
to save snapshot: [403] Updating the checkpoint is not permitted for
preview operations.` on every preview operation.
2024-04-12 18:40:55 +00:00
VenelinMartinov c81c236354
Fix nil pointer dereference in pulumi new --ai ()
<!--- 
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

Found by @Frassle

We were dereferencing the response pointer before checking the returned
error, resulting in a nil pointer dereference.

<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->

Fixes https://github.com/pulumi/pulumi/issues/15860

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] 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. -->
2024-04-04 15:26:09 +00:00
Komal 060382685e
Pass in a header to indicate where the deployment initiated ()
<!--- 
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 https://github.com/pulumi/pulumi/issues/12493

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] 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. -->
2024-02-20 04:00:01 +00:00
Luke Hoban bb3aa1c529
Add `--suppress-progresss` flag to CLI ()
Adds support for suppressing the periodic "..." printing that can
disrupt normal output stream. This output is still deemed necessary to
include by default for CI systems that might otherwise cancel an update
that goes for a long time without printing anything. But we now have an
option to turn this off.

Notes:
1. We want to expose this via Automtation API, and may even want to
default to off via Automation API?

Fixes https://github.com/pulumi/pulumi/issues/14069.
Related https://github.com/pulumi/pulumi/issues/11139.
2024-02-05 11:48:10 +00:00
Komal bdebae8bb3
Add preview-only flag for destroy and import ()
<!--- 
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. -->

Figured I could round out  while I was in the area.

Fixes  
Fixes  
Fixes 

## 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. -->
2024-02-02 00:29:03 +00:00
Komal 0e11f91039
Implement preview-only refresh ()
<!--- 
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. -->

Adds a `preview-only` flag to `pulumi refresh`.

Fixes  

## 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. -->
2024-02-01 20:30:40 +00:00
Fraser Waters afb287d2fb
Rename filestate to DIY ()
This goes through the codebase to try and be consistent about names for
the diy/filestate/local/selfmanaged backend. Every reference to this
backend should now use the terms "DIY". There are a couple of places
that still say "local DIY backend" this is referring to a DIY backend
using the local filesystem (i.e. `pulumi login --local`).
2024-01-30 15:53:10 +00:00
Komal 87d1090d9f
Replace a type used by the service ()
<!--- 
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. -->

A type that is used by the Pulumi Cloud code was removed in
[](https://github.com/pulumi/pulumi/pull/15028/files#diff-52b25675ac0d98614d062fc1d1c9e60759f905cf7c60a9339402a62c23cc2c55L32-L33)
- this PR replaces it.

Fixes # (issue)

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] 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. -->
2024-01-23 19:15:29 +00:00
Thomas Gummerer baecc85eaf
turn on the golangci-lint exhaustive linter ()
Turn on the golangci-lint exhaustive linter.  This is the first step
towards catching more missing cases during development rather than
in tests, or in production.

This might be best reviewed commit-by-commit, as the first commit turns
on the linter with the `default-signifies-exhaustive: true` option set,
which requires a lot less changes in the current codebase.

I think it's probably worth doing the second commit as well, as that
will get us the real benefits, even though we end up with a little bit
more churn. However it means all the `switch` statements are covered,
which isn't the case after the first commit, since we do have a lot of
`default` statements that just call `assert.Fail`.
 
Fixes  

## 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. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] 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. -->
2024-01-17 16:50:41 +00:00
Kyle Pitzen c94390112a
Adds Pulumi AI integrations with Pulumi New ()
<!--- 
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. -->

Now that we support .zip archive sources for Pulumi New, we have all of
the API surface we need to provide a full Pulumi New experience using
Pulumi AI. This PR introduces a few modes of interacting with Pulumi AI
to generate Pulumi projects.

- The default `pulumi new` experience now begins with a choice between
`ai` and `template` modes - the `template` mode represents the current
state of running `pulumi new`, while `ai` provides an interactive
experience with Pulumi AI.
- The user can iteratively ask questions to improve or change the
resulting program - each time a prompt is completed, they are asked to
`refine`, `no`, or `yes` their session - `refine` allows a follow-on
prompt to be submitted. `no` ends the session without generating a
pulumi project, and `yes` generates a Pulumi project from the most
recent program returned by Pulumi AI.
- Additionally, top-level flags, `--ai` and `--language` are provided to
fill in default values for the AI mode. When a prompt is provided with a
language, it is automatically submitted to Pulumi AI - if either is
missing, the user is prompted for whichever value is missing.

Fixes https://github.com/pulumi/pulumi.ai/issues/441
Fixes https://github.com/pulumi/pulumi.ai/issues/443
Fixes https://github.com/pulumi/pulumi.ai/issues/444

Depends on https://github.com/pulumi/pulumi.ai/pull/472
Depends on https://github.com/pulumi/pulumi.ai/pull/507
Depends on https://github.com/pulumi/pulumi.ai/pull/508

## 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. -->

---------

Co-authored-by: Aaron Friel <mayreply@aaronfriel.com>
2023-12-20 22:08:09 +00:00
Fraser Waters 16d9f4c167
Enable perfsprint linter ()
<!--- 
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. -->

Prompted by a comment in another review:
https://github.com/pulumi/pulumi/pull/14654#discussion_r1419995945

This lints that we don't use `fmt.Errorf` when `errors.New` will
suffice, it also covers a load of other cases where `Sprintf` is
sub-optimal.

Most of these edits were made by running `perfsprint --fix`.

## 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. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] 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-12-12 12:19:42 +00:00
Fraser Waters f4c7800a7c
Fix login help ()
<!--- 
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 https://github.com/pulumi/pulumi/issues/14757.

Fixes the help message when login fails to say:
Run pulumi login --help for alternative login options.

Rather than:
Run pulumi --help for alternative login options.
2023-12-12 09:26:40 +00:00
Fraser Waters f36ce248b2
Add --import-file to pulumi preview ()
<!--- 
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 https://github.com/pulumi/pulumi/issues/12768.

This will generate an import file for every resource the preview wants
to Create.

## 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
  - [ ] 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-12-05 08:32:40 +00:00
Pat Gavlin ecb58cc9f7
[cli] Include config from ESC in `pulumi config` ()
These changes include any configuration values sourced from a stack's
ESC environment to the output of `pulumi config`.

These changes also add an `ENVIRONMENT` block to the output of `pulumi
config` for stacks that reference environments. This block shows the
definition of the stack's environment.

Finally, these changes add a warning to `pulumi config` if the stack's
ESC environment does not define any of the `environmentVariables`,
`files`, or `pulumiConfig` properties.
2023-11-21 10:44:45 +00:00
Fraser Waters 6f21cac6f3
Make `engine.NewEvent` type safe ()
<!--- 
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. -->
Small refactor I noticed while writing a test with engine events. We
always had to call `NewEvent` with the tag and payload value for an
event and these _had_ to match up else the engine panics. But we can
just pass the payload and type switch to work out the tag. Means one
less parameter to pass to `NewEvent` and pretty much no chance of it
going wrong. To ensure there's really no chance I've added a generic
union type so you can only pass payload types to this method now.

Cancel had to be handled separately because it doesn't have a payload
type, it's just nil.
2023-11-16 16:54:03 +00:00
Fraser Waters d771acf707
Add tokens.StackName ()
<!--- 
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. -->

This adds a new type `tokens.StackName` which is a relatively strongly
typed container for a stack name. The only weakly typed aspect of it is
Go will always allow the "zero" value to be created for a struct, which
for a stack name is the empty string which is invalid. To prevent
introducing unexpected empty strings when working with stack names the
`String()` method will panic for zero initialized stack names.
 
Apart from the zero value, all other instances of `StackName` are via
`ParseStackName` which returns a descriptive error if the string is not
valid.

This PR only updates "pkg/" to use this type. There are a number of
places in "sdk/" which could do with this type as well, but there's no
harm in doing a staggered roll out, and some parts of "sdk/" are user
facing and will probably have to stay on the current `tokens.Name` and
`tokens.QName` types.

There are two places in the system where we panic on invalid stack
names, both in the http backend. This _should_ be fine as we've had long
standing validation that stacks created in the service are valid stack
names.

Just in case people have managed to introduce invalid stack names, there
is the `PULUMI_DISABLE_VALIDATION` environment variable which will turn
off the validation _and_ panicing for stack names. Users can use that to
temporarily disable the validation and continue working, but it should
only be seen as a temporary measure. If they have invalid names they
should rename them, or if they think they should be valid raise an issue
with us to change the validation code.

## 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
  - [ ] 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.
-->
- [ ] 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-11-15 07:44:54 +00:00
Thomas Gummerer f278fa9696
stack ls: remove misleading updateInProgress output for file backend ()
File backends currently do not support indicating whether an operation
is currently in progress or not. In the `stack ls --json` output we
always end up with a "updateInProgress = false" field, even when an
update is in progress. This is misleading.

Disable showing this erroneous and misleading output.

Fixes 

Based on Luke's comments in that issue, I believe we should merge this
as bug fix for the issue, and then open a separate feature request
tracking the implementation of tracking whether an update is in progress
in the file backend.

## 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-27 07:33:07 +00:00
Fraser Waters 10c1e1baaa
Cleanup result.Result in pkg/engine ()
A big change for result.Result cleanup. This removes all references to
the Result type from pkg/engine. This was mostly just search replace.
Points to note, we still map to `result.Result` in pkg/backend (that
will be the next big result change to deal with), and a little bit of
fiddlyness with multiple error values in test_plan.go `runWithContext`.
2023-10-11 14:44:09 +00:00
Pat Gavlin fd8c4dd819
[httpstate] cli-login update ()
Add a `cliCommand` query parameter when `Login`'s caller is not
`pulumi`.
2023-10-10 21:38:36 +00:00
Pat Gavlin fbfdddf2df
[backend] Separate login and backend creation ()
Allow callers to retrieve Pulumi account information without creating a
full-fledged backend.
2023-09-26 14:24:36 +00:00
Fraser Waters 61dcd6f6ca
Add token info to whoami ()
<!--- 
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 https://github.com/pulumi/pulumi-cloud-requests/issues/236

## 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
  - [ ] 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-09-23 12:46:11 +00:00
Fraser Waters cea3d70f2b
Write out snapshot errors to the user error stream ()
<!--- 
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. -->

Currently if the engine encounters an error writing out snapshots it
only logs that to the V11 log.

We'd like to get to the point where the engine doesn't write out invalid
snapshots in the first place, but doing this in small steps to reduce
blast radius of changes to a core engine loop.

This is the first step, we'll log the error to the user error stream so
it's more noticeable than just being in the developer logs at -v11.

## 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
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] 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-09-22 20:20:35 +00:00
Fraser Waters 79271cf543
Replace result.Result in Query with error ()
Continued cleanup of result.Bail with error. This cleans up the codepath
using Query.
2023-09-20 15:43:46 +00:00
Fraser Waters 65f3493126
Move SecretsManager from SnapshotPersister to SnapshotManager ()
<!--- 
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. -->

It should never have really been the role of the persister to decide
what SecretsManager to use, and they were in practice always being setup
with a SnapshotManager anyway so not a lot of code to move the secrets
manager around. This also gets the httpstate and filestate backends in
alignment over which SecretsManager variable they're going to use.

## 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
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] 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-09-19 18:31:56 +00:00
Fraser Waters 6e6735ed29
Remove Logout logic from Backend interface ()
<!--- 
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. -->

Backends themselves don't actually need any logout logic. Logging out is
mearly a function of deleting the account from the credentials file and
is the same for filestate, httpstate and probably any other state we
introduce.

This also simplifies the code "logout --all" which used to try and
lookup the project, make up a dummy httpstate object, and then call
LogoutAll to call workspace.DeleteAllAccounts. Now it goes straight to
that last call.

## 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
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] 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-09-18 17:21:32 +00:00
Fraser Waters 4ebf61f896
Move sdk/go/common/display to /pkg/display ()
Similar to how https://github.com/pulumi/pulumi/pull/13953 moves some
code from sdk/go/common to /pkg. This display code is only used in /pkg,
another simple reduction of what's in sdk/go/common.
2023-09-18 11:01:28 +00:00
Kyle Pitzen 1a02b1b68d
Safeguards org search against unset default orgs ()
<!--- 
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. -->

Currently, if a user has no default org set, and no org is provided via
--org, `GetBackendConfigDefaultOrg` returns nothing, which means no org
is provided when querying the Pulumi Cloud service - this results in a
404, and a nil pointer error when attempting to retrieve query
parameters from that API call. This falls back to the user name when no
org is provided by the user or retrieved by
`GetBackendConfigDefaultOrg`, as well as returning an error when one
arises from the service call rather than returning the error later.

## 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
  - [ ] 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-09-13 22:09:04 +00:00
Kyle Pitzen 5feb846817
Addresses initial Org Search feedback ()
<!--- 
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. -->

Based on initial Org Search feedback, we were missing a few things in
the original implementation. This adds the following:
- Displays the raw query which was submitted to Pulumi for both basic
org search and AI assisted search
- Validates whether the org provided is the user's individual org - AI
assist and search is not supported for individual orgs
- Aligns `pulumi org search` syntax with that supported in the console.

## 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
  - [ ] 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. -->

---------

Co-authored-by: Aaron Friel <mayreply@aaronfriel.com>
2023-09-12 00:18:43 +00:00
Kyle Pitzen fe639f40d2
[org search] Adds both the display of and the ability to open search results URLs ()
<!--- 
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. -->

Displays to users a copyable URL to view org search results in Pulumi
Cloud as well as a `--web` flag to automatically open those results for
them.

Fixes https://github.com/pulumi/pulumi.ai/issues/207

## 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
  - [ ] 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-09-11 16:33:56 +00:00
Kyle Pitzen 59c08cb219
Adds two new CLI features - search and AI search ()
Adds initial pulumi search implementation

<!--- 
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 https://github.com/pulumi/pulumi/issues/13489
Fixes https://github.com/pulumi/pulumi/issues/12868

## 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
  - [ ] 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-08-21 15:06:46 +00:00
Kyle Dixler 71ec5b7dfa
`pulumi new -s 'org/project/stack'` checks the proper organization for project existence rather than backend.currentUser()'s org. 2023-07-03 09:28:52 -07:00
Fraser Waters 571fadae3f Use slice.Prealloc instead of make([]T, 0, ...)
Fixes https://github.com/pulumi/pulumi/issues/12738

https://github.com/pulumi/pulumi/pull/11834 turned on the prealloc
linter and changed a load of slice uses from just `var x T[]` to `x :=
make([]T, 0, preallocSize)`. This was good for performance but it turns
out there are a number of places in the codebase that treat a `nil`
slice as semnatically different to an empty slice.

Trying to test that, or even reason that through for every callsite is
untractable, so this PR replaces all expressions of the form `make([]T,
0, size)` with a call to `slice.Prealloc[T](size)`. When size is 0 that
returns a nil array, rather than an empty array.
2023-06-29 11:27:50 +01:00
Ian Wahbe ea7c3e4d5d Improve the stack validation error message
Previously, the error message was:

```
error: a stack name may only contain alphanumeric, hyphens, underscores, or periods
```

This wasn't great because it lacked specificity, but was especially bad if candidate stack
name was >100 characters or empty.

The new error messages are as follows:

1. If empty: "a stack name may not be empty"
2. If >100 chars: "a stack name cannot exceed 100 characters"
3. If it contains invalid characters: "a stack name may only contain alphanumeric,
   hyphens, underscores, or periods: invalid character %q at position %d" (with the
   appropriate values filled in).

Add tests

Add changelog

Fix lint

Respond to feedback
2023-06-28 00:48:19 +02:00
Abhinav Gupta e7aa7c484f
sdk/go: Add tokens.ValidateProjectName
As pointed out in
https://github.com/pulumi/pulumi/pull/13078#discussion_r1227854722,
we repreatedly reimplement the project name validation logic.

This moves it to a central place: `tokens.ValidateProjectName`,
and re-uses it in existing places where copies were found.
2023-06-13 10:08:31 -07:00
Fraser Waters 89a7922b08 Support 'pulumi:tags' config to set stack tags
Fixes https://github.com/pulumi/pulumi/issues/5004
2023-05-24 09:02:22 +01:00
Fraser Waters dbf8151a5c Don't pass a second SecretsProvider to backend.Watch
`backend.Watch` was taking a `SecretsProvider` parameter, but it already
took an `UpdateOperation` parameter which already has a `SecretProvider`
on it. So now we just use that.
2023-05-08 20:38:40 +01:00
Fraser Waters 1376a13d13 Fix destroy without project file
Fixes https://github.com/pulumi/pulumi/issues/12714.

The empty project created for destroy operations when no Pulumi.yaml is
found still needs to have it's name filled in so that project name
consistency checks work.

Our tests didn't pick this up because for filestate we were still
searching from the working directory for consistency checks rather than
checking the backends current project. I have _not_ changed that in this
changeset as previosly that triggered total breakage of the filestate
backend when not in project mode (see
https://github.com/pulumi/pulumi/issues/12760).
2023-05-02 10:36:16 +01:00
Justin Van Patten 6219b6d833 Revert "Fix destroy without project file"
This reverts commit 5eb04f18ad.
2023-04-26 18:17:08 -07:00
Fraser Waters 5eb04f18ad Fix destroy without project file
Fixes https://github.com/pulumi/pulumi/issues/12714

The empty project created for destroy operations when no Pulumi.yaml is
found still needs to have it's name filled in so that project name
consistency checks work.

Our tests didn't pick this up because for filestate we were still
searching from the working directory for consistency checks rather than
checking the backends current project. I've also fixed that up as part
of this change.
2023-04-24 16:14:56 +01:00
Kyle Dixler d9ae0045ed
Enable display of backend messages during updates
Augments UpdateProgramResponse to add a field named messages that
contains a list of messages to show to the user of the format:
    {
        message: string,
        severity: "error" | "warning" | "info"
    }

Messages are printed during an update above the permalink in the case of
the http backend.
2023-04-21 14:44:40 -07:00
Abhinav Gupta 29ce91aa8a
pkg/backend: Delete SupportsTeams methods
This deletes the SupportsTeams method added in .
It came up during review that we want to avoid too many new
"SupportsFoo" methods.

Instead, we'll let each backend report whether it supports teams
by returning ErrTeamsNotSupported.

As a result of this change, validateCreateStackOpts cannot error,
so it's been renamed to newCreateStackOptions.

Testing:
There's already a test (added in the  refactor)
that verifies that we report the appropriate error
when the backend doesn't support --teams.
This updates the mock in that test.
2023-03-29 11:07:58 -07:00
bors[bot] f7c940e7c2
Merge
11974: Add --teams flag to assign team name to stack. r=RobbieMcKinstry a=RobbieMcKinstry

<!--- 
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

This PR adds a --teams flag to `pulumi stack init` which accepts a string. This flag can be provided multiple times. Each team that is provided is assigned read/write permissions on the stack after it has been initialized.

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes 

## Checklist

<!--- 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 Service,
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 Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Robbie McKinstry <robbie@pulumi.com>
Co-authored-by: Robbie McKinstry <thesnowmancometh@gmail.com>
Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
2023-03-21 19:36:53 +00:00