Commit Graph

68 Commits

Author SHA1 Message Date
Pat Gavlin 064fb93587
[esc] Add commands for managing stack environments ()
These changes add two commands for managing a stack's environments:

- `pulumi config env add`, which adds environments to a stack's import
list
- `pulumi config env rm`, which removes an environment from a stack's
import list

As implied by their paths, these commands hang off of a new sub-command
of `pulumi config`, `pulumi config env`.

From the usage:

* `pulumi config env add`

Adds environments to the end of a stack's import list. Imported
environments are merged in order per the ESC merge rules. The list of
stacks behaves as if it were the import list in an anonymous
environment.

* `pulumi config env rm`

Removes an environment from a stack's import list.

Each of these commands previews the new stack environment and shows the
environment definition. These commands print a warning if the stack's
environment does not define any of the `environmentVariables`, `files`,
or `pulumiConfig` properties.
2023-11-22 05:04:14 +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
Pulumi Bot 000b9fd5e6
Changelog and go.mod updates for v3.94.2 ()
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Fraser Waters <fraser@pulumi.com>
2023-11-19 12:43:09 +00:00
Fraser Waters 84ac5036d9
Update esc to v0.6.0 ()
Should help with the `cli.PrepareEnvironment` build issues some people
have been seeing.
2023-11-17 07:39:36 +00:00
Pulumi Bot 213b90c687
Changelog and go.mod updates for v3.94.1 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-11-16 22:33:26 +00:00
Pulumi Bot 4fbb6ba0bb
Changelog and go.mod updates for v3.94.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-11-15 07:56:50 +00:00
Pulumi Bot 3b6f5e0148
Changelog and go.mod updates for v3.92.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-11-03 16:42:03 +00:00
Bryce Lampe cbcad3277e
Allow shallow clones for local workspaces ()
<!--- 
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 exposes a GitRepo option to enable shallow cloning repositories.
This is helpful in cases where the repo has a large history.


## 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. -->
2023-11-01 17:21:52 +00:00
Thomas Gummerer 4a577563ef
upgrade pulumi-yaml to 1.4.0 ()
Upgrade pulumi-yaml to the latest version
2023-10-28 07:25:27 +00:00
Pat Gavlin 06f1154a82
[esc] update to v0.5.7 ()
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2023-10-28 02:10:00 +00:00
Pulumi Bot 44ec0bc710
Changelog and go.mod updates for v3.91.1 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-10-28 01:42:26 +00:00
Pulumi Bot 6e94043cfb
Changelog and go.mod updates for v3.91.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-10-26 12:19:55 +00:00
Pulumi Bot 8d9725e35f
Changelog and go.mod updates for v3.90.1 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-10-24 20:20:48 +00:00
Pulumi Bot e59f8b03b1
Changelog and go.mod updates for v3.90.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-10-23 20:48:09 +00:00
Justin Van Patten 9d653491f6
[chore] update esc ()
Pin to v0.5.6 to pick up the CLI doc generation fix, and other
improvements.

Fixes 
2023-10-19 19:42:54 +00:00
Fraser Waters 2c74dddc91
Switch to use env.Env in filestate ()
Internal refactor to use `env.Env` directly in filestate rather than
mocking `os.Getenv`.
2023-10-18 10:52:54 +00:00
Pulumi Bot a45ec3d1eb
Changelog and go.mod updates for v3.89.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-10-17 07:13:08 +00:00
Pulumi Bot 576ff5023a
Changelog and go.mod updates for v3.88.1 ()
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2023-10-12 01:26:11 +00:00
Pat Gavlin 7e189e3a78
[chore] update esc ()
Pin to v0.5.2 to pick up a couple of bug fixes and a new command-line
option for `env init`.
2023-10-11 16:57:30 +00:00
Pulumi Bot 58aeed028e
Changelog and go.mod updates for v3.88.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-10-10 04:39:00 +00:00
Pat Gavlin 4d3b82cb9f
[cli] Add support for environments ()
These changes add support for ESC environments to the Pulumi CLI. This
involves two major changes:

- Support for the `env` subcommand
- Support for the `environment` stanza in stack config files

The former reuses the command from `esc` itself with a little
rebranding.

The latter adds support to stack config files for an `environment`
property of the form:

```yaml
environment:
  - list
  - of
  - environment
  - names
```

If this property is present in a stack's config file, the CLI will open
the and merge the listed environments during `pulumi up` et. al. If an
object-valued `pulumiConfig` property is present in the opened
environment, its values will be merged on top of the stack's config
prior to whatever operation is to be performed. If an object-valued
`environmentVariables` property is present inthe opened environment, its
values will be published as environment variables prior to the Pulumi
operation. Any values in the open environment's `pulumiConfig` or
`environmentVariables` that are marked as secret will be encrypted in
the resulting config and will be filtered from the command's logs.
2023-10-10 01:35:39 +00:00
Pat Gavlin 6756c12fd0
[config] Clean up implementation ()
These changes replace the idiosyncratic implementation of some of the
config Map and Value APIs with (hopefully) more straightforward code.

The fundamental representation of a config.Value remains a (value,
secure, object) tuple, where value is either a plain, possible-encrypted
string value or the JSON encoding of an object value. All operations on
values that need to observe the object value itself still decode the
JSON representation into a richer representation. This richer
representation, however, is no longer composed of `any` values: instead,
it is composed of `object` values. These values contain a restricted set
of types and directly track whether or not their contents are a secure
string value. The object-based representation allows for much clearer
implementations of the marshaling and traversal code without breaking
compatibility.

In addition to the new implementation for config.Value, these changes
add a config.Plaintext type that represents a plaintext config value. A
Plaintext value can be created manually or by decrypting a Value, and
can be encrypted and converted to a Value. This allows for more natural
creation and manipulation of config values.
2023-10-09 04:51:21 +00:00
Pulumi Bot 3c166d5084
Changelog and go.mod updates for v3.87.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-10-06 21:32:44 +00:00
Fraser Waters bf601d2070
Update golang.org/x/mod ()
<!--- 
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. -->

Go 1.21.1 is now adding new toolchain declarations to go.mod files. This
updates our dependency for this so users shouldn't hit errors due to
toolchain bits in their go.mod files.

## Checklist

- [x] 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. -->
2023-09-28 21:07:26 +00:00
Pulumi Bot 1b138640d0
Changelog and go.mod updates for v3.86.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-09-26 18:46:11 +00:00
Pulumi Bot 0dec4d8821
Changelog and go.mod updates for v3.85.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-09-23 06:06:55 +00:00
Kyle Dixler 779f82dfdd
[`pulumi new` wrapping] Fix pulumi new selector wrapping on narrow terminals. ()
<!--- 
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/8169
Fixes https://github.com/pulumi/pulumi/issues/11812

Bump survey to v2.3.7 which contains a fix for
https://github.com/go-survey/survey/issues/101

Old: https://asciinema.org/a/jhHadL382jrzrLiU9vAsV7YR9
New: https://asciinema.org/a/lEVkdm1UdMXwUWdpipMxLGOga

## 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.
-->
- [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-20 14:48:41 +00:00
Pulumi Bot 1d98c99ac6
Changelog and go.mod updates for v3.84.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-09-20 06:02:47 +00:00
Pulumi Bot 0d5e13c2bc
Changelog and go.mod updates for v3.83.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-09-17 11:39:57 +00:00
Kyle Dixler e78f98e2ab
Revert "PoC: cli/new: Use bubbletea for template list" ()
Reverts 

Temporarily reverting this until we make some improvements to the
experience.
2023-09-15 20:29:18 +00:00
Abhinav Gupta 630a790a23
PoC: cli/new: Use bubbletea for template list ()
Switches the survey-based list picker we use to pick a template
to use bubbletea with the bubbles/list widget.
Instead of using any of the default bubbles/list renderings,
this implements a custom renderer for list items (the delegate)
that provides an experience closer in look to the 'pulumi new' today.

Related to  in spirit.

Fixes 
Fixes 

---

Demos

<details>
<summary>Basic usage</summary>


[![asciicast](https://asciinema.org/a/NeecyanZP2iyzlrAOKRiKckJZ.svg)](https://asciinema.org/a/NeecyanZP2iyzlrAOKRiKckJZ)

</details>

<details>
<summary>Handling of really small terminals</summary>


[![asciicast](https://asciinema.org/a/RZW3NfX5SQ8rL4mR1iRLQ6yi1.svg)](https://asciinema.org/a/RZW3NfX5SQ8rL4mR1iRLQ6yi1)

</details>
2023-09-14 19:48:54 +00:00
Pulumi Bot 65b20a475e
Changelog and go.mod updates for v3.82.1 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-09-13 00:46:50 +00:00
Pulumi Bot ab52f78570
Changelog and go.mod updates for v3.82.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-09-12 23:10:17 +00:00
Pulumi Bot d44f3fd763
Changelog and go.mod updates for v3.81.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-09-07 21:17:41 +00:00
Pulumi Bot 9d789582da
Changelog and go.mod updates for v3.80.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-09-01 07:09:11 +00:00
Abhinav Gupta b51caa6ab4
cmdutil.ReadConsole[NoEcho]: Use bubbletea ()
Switch the cmdutil.ReadConsole and cmdutil.ReadConsoleNoEcho functions
to use the bubbletea library to render the prompt,
using the textinput widget provided by the accompanying bubbles library.
The resulting input widgets support arrow keys, back space,
and some basic readline-style bindings including Ctrl-A, Alt-B, etc.

I went through all uses of ReadConsole or ReadConsoleNoEcho.
Only the one in new.go had a non-compliant prompt that I had to adjust.

Note: One divergence in behavior I opted for was that
password prompts will echo '*' characters as the user is typing
and then no echo once they've accepted or canceled the value.
Previously, the prompt did not echo anything in either case.

<details>

  <summary>
  Introduction if you're unfamiliar with bubbletea
  </summary>

  bubbletea operates by modeling the widget state as
  an immutable data structure that receives messages for events.
  On receiving a message (key press, e.g.) the model's Update method
  returns a new model instance representing its new state.
  Update may also optionally return additional commands for the program,
  e.g. stop running, or print something and move on.
  The model's View method returns what should be drawn in the terminal
  based on the model's current state.
This programming model makes it reasonably straightforward to unit test
  some of the core functionality of independent widgets
  as demonstrated in this PR.

</details>

Resolves 

---

Demos:

<details>
  <summary>Plain text</summary>
  

![prompt-plain](https://github.com/pulumi/pulumi/assets/41730/66258fc8-f772-4d01-bc7c-1f7b116aebaa)
</details>

<details>
  <summary>Secret</summary>


![prompt-secret](https://github.com/pulumi/pulumi/assets/41730/372f862e-9186-4d47-ba7d-0107c47f52f6)
</details>

<details>
  <summary>Secret prompt with padding</summary>


![prompt-secret-2](https://github.com/pulumi/pulumi/assets/41730/e9b7c253-4c9d-4235-9fa6-197aa0522033)
</details>
2023-08-30 17:08:44 +00:00
Justin Van Patten 37954685bb
Changelog and go.mod updates for v3.79.0 ()
Co-authored-by: github-actions <github-actions@github.com>
2023-08-26 00:21:43 +00:00
github-actions 432c5b78ec chore: post-release go.mod updates 2023-08-11 15:08:16 +00:00
bors[bot] cb914ec741
Merge
13619: update aws-sdk to sso session supported version r=Frassle a=TheFynx

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

Allows for the use of sso-session backed AWS Profiles

- Log out of cloud
 ```bash
❯ ~/.pulumi-dev/bin/pulumi logout
Logged out of https://app.pulumi.com
```

- Try to log in with awssdk=v2 with sso-session profile, existing error
 ```bash
❯ ~/.pulumi-dev/bin/pulumi login 's3://state-bucket?region=us-east-1&awssdk=v2&profile=AwsProfile'
error: problem logging in: unable to open bucket s3://state-bucket?region=us-east-1&awssdk=v2&profile=AwsProfile: open bucket s3://state-bucket?region=us-east-1&awssdk=v2&profile=AwsProfile: profile "AwsProfile" is configured to use SSO but is missing required configuration: sso_region, sso_start_url
```

- Try to log in with awssdk=v3 with sso-session profile, success
 ```bash
❯ ~/.pulumi-dev/bin/pulumi login 's3://state-bucket?region=us-east-1&awssdk=v3&profile=AwsProfile'
Logged in to levi-framework as levi (s3://state-bucket?region=us-east-1&awssdk=v3&profile=AwsProfile)
```

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

## 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
	- Notes: Unsure if tests are needed to do a package update 
<!--- 
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. -->


13682: Lock access to the plugin loading channels r=Frassle a=Frassle



<!--- 
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/12371.

This locks access to the plugin request channels with a RWLock. Before trying to write to the channel we try to take a Read lock (yes this sounds the wrong way round, carry on). Many loaders are free to send to the loadRequest channel at once, but we use the read lock to atomiclly track if any are currently in progress.

When we go to close the plugin host the first thing we do is take a Write lock. Firstly this can't be taken until all the read locks are released indicating that no plugins are currently loading, but secondly while the write lock is taken no more read locks can be taken blocking any further plugin loads from starting.

We never release this write lock, thus permenatly blocking plugin loads once `Close` is called. So that we don't indefinently block inside load calls we do a `TryRLock` and return an error if the read lock can't be taken.

With this locking in place the rest of `Close` is then free to shut down all current plugins and close of the request channels, assured that they shouldn't be posted to again as the lock stays held.

## 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.
-->
- [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: Levi Smith <levithegeek@gmail.com>
Co-authored-by: Levi Smith <levi@fynx.me>
Co-authored-by: Fraser Waters <fraser@pulumi.com>
2023-08-10 22:48:30 +00:00
github-actions 78364c5548 chore: post-release go.mod updates 2023-08-10 07:48:50 +00:00
github-actions cfbde2f244 chore: post-release go.mod updates 2023-08-05 03:17:38 +00:00
github-actions e69c3eb26d chore: post-release go.mod updates 2023-08-04 14:48:26 +00:00
Levi Smith 35e7745f46 update aws-sdk to sso session supported version 2023-07-28 16:13:17 +00:00
Abhinav Gupta 91a079851b
deps: Upgrade google.golang.org/{genproto, grpc}
Updates to the latest versions of
google.golang.org/genproto and google.golang.org/grpc
in all submodules in the repository.

This is necessary because in a recent change,
genproto split out some of its subpackages into independent submodules.
(https://github.com/googleapis/go-genproto/issues/1015)

As a result of this, some users may see the error:

```
google.golang.org/genproto/googleapis/rpc/status: ambiguous import: found package google.golang.org/genproto/googleapis/rpc/status in multiple modules:
    google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 (/home/runner/go/pkg/mod/google.golang.org/genproto@v0.0.0-20230410155749-daa745c078e1/googleapis/rpc/status)
    google.golang.org/genproto/googleapis/rpc v0.0.0-20230725213213-b022f6e96895
```

Because pu/pu is using 20230410155749,
which has googleapis/rpc as a subpackage,
but another dependency references the independent submodule (20230725213213),
so the system doesn't know which module to use for the import path,
google.golang.org/genproto/googleapis/rpc/status.

This is a problem for codegen tests and ProgramTest-based tests
for Pulumi Go programs that do not have a go.mod in the test directory.
This issue was encountered by @thomas11 while attempting to upgrade
dependencies in pulumi-docker ().

The grpc upgrade is necessary because the current version of grpc
also pulls the outdated version of genproto.
2023-07-27 16:24:33 -07:00
github-actions ffaf1654ed chore: post-release go.mod updates 2023-07-26 19:28:47 +00:00
github-actions d113e896ef chore: post-release go.mod updates 2023-07-20 22:54:09 +00:00
Kyle Dixler 658021f5ff Add `pulumi state edit` utility.
Fixes 

Adds `pulumi state edit` an experimental utility for manually editing
pulumi stack state. The command mimics the `git commit` flow by opening
the stack's state in the text editor specified by the EDITOR environment
variable and then previews the file to be saved.

There are TODO comments detailing remaining steps to un-hide `pulumi
state edit`. Namely testing round-tripping unicode.
2023-07-17 09:47:05 -07:00
github-actions b967fd526c chore: post-release go.mod updates 2023-07-12 23:26:48 +00:00
Abhinav Gupta f59ab49fc5
deps(go): Upgrade to grpc 1.56.1
Upgrades to gRPC Go 1.56.1 to resolve the influx of dependabot PRs.
Supersedes all dependabot PRs created for this.

Fixes CVE-2023-32731
2023-07-06 09:04:16 -07:00
Justin Van Patten 60e68e7ec0 chore: post-release go.mod updates 2023-06-30 10:40:11 -07:00