Commit Graph

25 Commits

Author SHA1 Message Date
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 64d9266deb
Update pu/pu to support the new settings pull command + new deployment file ()
<!--- 
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 settings pull command: this command will pull the
deployment settings from pulumi cloud and generate the new deployment
file. For now it will be hidden until we have completed the whole
feature.
- Add support for the new deployment file, this will contain all the
deployment related information (for now just the settings), example:

```
settings:
  -executorContext: {}
    sourceContext:
      git:
        branch: main
        repoDir: .
    gitHub:
      repository: glena/test-action
      deployCommits: true
      previewPullRequests: false
    operationContext:
      preRunCommands: []
      operation: ""
      environmentVariables: {}
      options:
        skipInstallDependencies: false
        skipIntermediateDeployments: true
        shell: ""
        deleteAfterDestroy: false
        remediateIfDriftDetected: false
    agentPoolID: ...
```

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

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

---------

Co-authored-by: Komal <komal@pulumi.com>
Co-authored-by: Will Jones <will@sacharissa.co.uk>
2024-06-18 13:24:01 +00:00
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
Fraser Waters e6e7b5e75e Remove the global caches for project files
Fixes https://github.com/pulumi/pulumi/issues/12152
2023-03-07 12:44:24 +00:00
Abhinav Gupta 7bddec255d
sdk/go: Prefer contract.Assertf over Assert
Migrates all uses of contract.{Assert, AssertNoError, Require} in sdk/
to the `*f` variants that are required to provide more error context.

Step towards deprecating non-f variants entirely.

For context, `contract.Require` is similar to `contract.Assert`,
except it has a required parameter name as an argument:

    func Require(cond bool, param string)
    func Requiref(cond bool, param string, msg string, args ...any)

It includes the parameter name in the error message by default,
so the `msg` and `args` should only describe the constraint
without naming the parameter.

Refs 
2023-02-15 10:22:43 -08:00
Abhinav Gupta 1158d4acee
all: Drop ioutil
Stop using io/ioutil across the entire repository.
The io/ioutil package was deprecated in Go 1.16 (2021-02)
with replacements provided in other packages.
Specifically:

    ioutil.Discard   => io.Discard
    ioutil.NopCloser => io.NopCloser
    ioutil.ReadAll   => io.ReadAll
    ioutil.ReadFile  => os.ReadFile
    ioutil.TempDir   => os.MkdirTemp
    ioutil.TempFile  => os.CreateTemp
    ioutil.WriteFile => os.WriteFile

This change switches all of these entities
across the repository.

Following this change,
the only references to ioutil are in schema files:

    % rg -l ioutil
    pkg/codegen/testing/test/testdata/aws-4.26.0.json
    pkg/codegen/testing/test/testdata/aws-4.36.0.json
    pkg/codegen/testing/test/testdata/aws-4.37.1.json
    pkg/codegen/testing/test/testdata/aws-5.4.0.json
    pkg/codegen/testing/test/testdata/aws-5.16.2.json

The bulk of this change was generated automatically
with manual touch ups afterwards.
2023-01-06 16:35:14 -08:00
Aaron Friel 5666684030 cli: Implement comment preserving edits on config, projects 2022-12-10 12:29:33 -08:00
Zaid Ajaj 42a51feb04 Allow project to be nil when namespacing project stack config 2022-10-12 16:23:16 +02:00
Zaid Ajaj 0766b866a6 Merge branch 'master' into minimal-config 2022-10-12 15:38:21 +02:00
Fraser Waters 800e6b4b53 Wrap project load errors with the path that failed 2022-10-09 12:08:05 +01:00
Zaid Ajaj 9a9a39bbf9 Make sure config defined by a stack are also defined by the project + a whole bunch of tests 2022-10-04 21:13:43 +02:00
Zaid Ajaj 77c7880e89 Fix reading empty project stack file 2022-09-26 12:49:07 +02:00
Zaid Ajaj fbc68cb644 Project namespace is now optional when defining stack config 2022-09-26 12:30:55 +02:00
Zaid Ajaj 0498be116b Rewrite config to stackConfigDir when provided as string 2022-09-24 14:32:11 +02:00
Zaid Ajaj 7975498b71 lint 2022-09-22 18:27:08 +02:00
Zaid Ajaj aa648fdd54 Implement short-hand configuration value support 2022-09-21 20:37:43 +02:00
Zaid Ajaj 966e96f86e Apply project config to stack config when appropriate 2022-09-21 15:52:14 +02:00
Zaid Ajaj 6c6b5cec7e Initial work on project-level config (MVP) 2022-09-20 20:13:45 +02:00
Fraser Waters 49d6ef0db9 Validate as part of Load not Unmarshal 2022-09-02 18:26:49 +01:00
Fraser Waters 5ff65320e2 Use project schema to validate projects we load 2022-09-02 10:09:24 +01:00
Ian Wahbe 2e5fedff54
Switch from golint to revive () 2021-09-21 10:00:44 -07:00
pulumi-bot 73a66f48ea [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
Levi Blackstone 20b78f49bc
[sdk/go] Use ioutil.ReadFile to avoid forcing 1.16 upgrade ()
 inadvertently changed the minimum Go version
requirement to 1.16 since ReadFile was moved in that
version. Switch back to ioutil.ReadFile to avoid forcing
an upgrade at this time.
2021-04-05 15:02:13 -06:00
Levi Blackstone 8cdac3e4ca
[cli] Strip Byte-order Mark (BOM) from YAML configs during load ()
Some YAML parsers don't correctly handle Byte-order marks,
so automatically strip it off during load.

Related to 

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2021-03-29 11:56:19 -06:00
Levi Blackstone a2f995d2bb
[sdk/go] Cache loaded configuration files ()
* [sdk/go] Cache loaded configuration files

Previously, the CLI did not cache configuration files, which
required a read from disk + unmarshalling + validation each
time a consumer needed to read one of these configurations.
This change introduces global caches for each type of Pulumi
configuration file (Project, ProjectStack, PolicyPackProject, and
PluginProject). The configuration is cached after the first request
and the cached value will be used for any subsequent operations.

Important note: The global configurations are not concurrency safe,
but this same problem exists using the previous method of
reading/writing config files on disk. Synchronization
will be added in a follow up change to allow for concurrency safe config
operations.
2021-03-19 10:52:12 -06:00