Commit graph

5334 commits

Author SHA1 Message Date
Pat Gavlin 807b09d6a6
Fix a few issues with resource references. (#5804)
- Differentiate between resource references that have no ID (i.e. because
  the referenced resource is not a CustomResource) and resource references
  that have IDs that are not known. This is necessary for proper
  backwards-compatible serialization of resource references.
- Fix the key that stores a resource reference's package version in the
  .NET, NodeJS, and Python SDKs.
- Ensure that the resource monitor's marshalling/unmarshalling  of inputs
  and outputs to/from calls to `Construct` retain resource references as
  appropriate.
- Fix serialization behavior for resources -> resource references in the
  Go SDK: if a resource's ID is unknown, it should still be serialized
  as a resource reference, albeit a reference with an unknown ID.
2020-11-23 11:15:10 -08:00
Paul Stack 8df7d24523
Trigger Template and Examples tests on a release (#5815)
Fixes: #5738

This will ensure we find any potential issues after a release
2020-11-23 17:47:57 +00:00
Komal 505d53421e
[codegen/python] - Include inputs import in provider.py (#5818) 2020-11-23 10:39:42 -06:00
Luke Hoban 4ecd8f9f56
Add PULUMI_BACKEND_URL env var (#5789)
The PULUMI_BACKEND_URL env var allows specifying the backend to use instead of deferring to the project or the ~/.pulumi/credentials.json file to decide on the "current" backend.  This allows for using Pulumi without a dependence on this piece of global filesystem state, so that each `pulumi` invocation can control the exact backend it want's to operate on, without having to do stateful `pulumi login`/`pulumi logout` operations.

This is especially useful for automation scenarios like Automation API generally (and effectively solves https://github.com/pulumi/pulumi/issues/5591), or https://github.com/pulumi/pulumi-kubernetes-operator/issues/83 specifically.

This also makes things like efe7a599e6/dist/actions/entrypoint.sh (L10) less necessary, and possible to accomplish for any containerized `pulumi` execution without the need for this logic to be embedded in bash scripts wrapping the CLI.
2020-11-22 15:27:59 -08:00
Justin Van Patten 9a707c4e03
Improve the output when installing plugins (#5808)
Two improvements:

1. Don't display "[resource plugin <foo>] installing" if the plugin is already installed.

2. Close the plugin download progress bar before displaying any subsequent output, and only show output of `npm install` when there is an error.
2020-11-21 08:02:05 -08:00
Pat Gavlin 20f7720869
Add support for getResource to the Python SDK. (#5694)
Just what it says on the tin.

The SDK code generator will be updated to use the new `urn`
resource option inside of each module's implementation of
`ResourceModule.construct`.

Part of #2430.

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2020-11-20 13:13:23 -08:00
Mikhail Shilkov a056daafd7
[codegen/dotnet] Handle external resource refs (#5791) 2020-11-20 21:09:34 +01:00
Pat Gavlin f527e06b21
Allow schemas to reference to provider types. (#5788)
These changes extend the type reference parser in the schema package to
accept references of the form "(package/version/schema.json)?#/provider".
These references refer to the package's provider type, which is
otherwise not referenceable, as it is not present in the "resources"
array.
2020-11-20 09:16:45 -08:00
Levi Blackstone 3586ab5d85
[codegen/python] Handle external schema refs (#5684) 2020-11-19 13:56:28 -07:00
Paul Stack 509be5003f
Ensure we pass a version with v prefix to bump-homebrew version (#5786) 2020-11-19 18:16:59 +00:00
Justin Van Patten 4c88e215ce
Respect PULUMI_PYTHON_CMD in scripts (#5782)
If `PULUMI_PYTHON_CMD` is set, use it instead of running `python` directly.
2020-11-18 19:08:41 -08:00
Vivek Lakshmanan 2b435bb1a7
Merge pull request #5670 from pulumi/vl/GoEnumsCodegen
Adding support for go enum generation
2020-11-18 11:54:30 -08:00
Pat Gavlin f0951ce650
Rename engine.plan to engine.deployment. (#5777)
This name better suits the semantics of the type, and aligns with the
rename of deploy.Plan to deploy.Deployment. These changes also refactor
the `update` method s.t. previews and updates are more consistent in
their behavior (e.g. duration and resource changes are now reported for
both, incl. on error paths).
2020-11-18 11:16:30 -08:00
Vivek Lakshmanan 1cfbe5bdd5 Linting fixes 2020-11-18 10:57:01 -08:00
Vivek Lakshmanan 1ba418ee7b
Merge pull request #5751 from pulumi/vl/VerboseBuild
Reduce verbosity on tests
2020-11-18 10:38:06 -08:00
stack72 3919ef5010 Ensure we call the correct build container action in the container build command-dispatch 2020-11-18 18:12:42 +00:00
stack72 342a024207 Ensuring that a GitHub Token is present in the workflow release for docker builds 2020-11-18 18:04:11 +00:00
Pat Gavlin 0981df6a7a
Rename deploy.Plan to deploy.Deployment. (#5774)
Rename deploy.Plan to deploy.Deployment.

There are two benefits to this change:

1. The name "Deployment" more accurately reflects the behavior of the
   type, which is responsible for previewing or executing a deployment.
2. Renaming this type frees up the name "Plan" for use when addressing
   #2318.
2020-11-18 09:47:52 -08:00
Vivek Lakshmanan d1caee26d3 Update makeSafeEnum semantics to match other languages 2020-11-18 09:44:30 -08:00
Vivek Lakshmanan 55e86bf078
Update sdk/python/Makefile
Co-authored-by: Komal <komal@pulumi.com>
2020-11-18 09:21:41 -08:00
stack72 8ade2f8319 Prepare for v2.14.0 release 2020-11-18 16:56:26 +00:00
Vivek Lakshmanan 221105a072 Ensure stderr is updated on error even if verbose is not set 2020-11-18 00:56:26 -08:00
Vivek Lakshmanan da5c01f9ca Fix build/tests 2020-11-18 00:13:41 -08:00
Vivek Lakshmanan 6e466e4ec0 Apply suggestions from code review
Co-authored-by: Komal <komal@pulumi.com>

Address PR comments
2020-11-18 00:08:09 -08:00
Vivek Lakshmanan c818098733 Address PR comment 2020-11-18 00:07:42 -08:00
Vivek Lakshmanan 65e027062d Add an underscore if enum values have underscores 2020-11-18 00:07:42 -08:00
Vivek Lakshmanan 41fff5dc08 Add type as prefix for enum values 2020-11-18 00:07:42 -08:00
Vivek Lakshmanan 169fb47154 Consolidate tests 2020-11-18 00:07:42 -08:00
Vivek Lakshmanan 3c2b7a8945 Add additional test to demonstrate strict/relaxed enum semantics 2020-11-18 00:07:42 -08:00
Vivek Lakshmanan 43e48950df Adding support for go enum generation 2020-11-18 00:07:42 -08:00
Vivek Lakshmanan 302f869dc5 Drop unnecessary prefix in test output since we rely on go's testing to do the right thing 2020-11-17 23:24:08 -08:00
Vivek Lakshmanan 84d1505807 Switch to using t.Logf instead of printf 2020-11-17 23:09:18 -08:00
Vivek Lakshmanan 0d6f9fdcbf Switch to pytest since it captures stdout/stderr and only prints on failure 2020-11-17 23:09:18 -08:00
Vivek Lakshmanan 98bc43d6d6 Disable verbose logging for python tests 2020-11-17 23:09:18 -08:00
Vivek Lakshmanan d12f59be46 Reduce verbosity on tests 2020-11-17 23:09:18 -08:00
Paul Stack 41a881a374
Small UX change to the output of policy violations (#5773)
Fixes: #5626

It used to be:

```
Policy Violations:
    [advisory]  aws v0.1.20200912  allowed-image-owner (demo-aws-ts-webserver-server-0: aws:ec2/instance:Instance)
    Check machine image is from an approved publisher.
    Publisher [137112412989] is not one of [self,099720109477].

```

Notice that it was name: type

We would rather this was type: name

```
Policy Violations:
    [advisory]  aws v0.1.20200912  allowed-image-owner (aws:ec2/instance:Instance: demo-aws-ts-webserver-server-0)
    Check machine image is from an approved publisher.
    Publisher [137112412989] is not one of [self,099720109477].

```
2020-11-17 21:14:28 +00:00
Tomas Jansson 89daaa2ff1
Output key and correct stack on keynotfound (#5740)
* Output key and correct stack on keynotfound

Co-authored-by: Mikhail Shilkov <github@mikhail.io>
2020-11-17 19:58:56 +01:00
Justin Van Patten bfe4969f35
.NET: Report plugin install errors during pulumi new (#5760)
The way `pulumi new` installs dependencies for .NET projects is slightly different from other languages. For Node.js, Python, and Go, `pulumi new` runs the appropriate command to install project dependencies (e.g. `npm install`, `pip install`, or `go mod download`). For .NET, it calls the same routine used during `preview|up` to ensure required plugins are installed. For .NET, this ends up running `dotnet build` which implicitly installs Nuget packages, builds the project, and also attempts to determine and install the needed Pulumi plugins. When this operation runs during `preview|up`, and there are failures installing a plugin, the error is logged, but deliberately not returned, because an error will be shown for missing plugins later on during the `preview|up` operation. However, during `pulumi new`, we should show any plugin install errors.
2020-11-16 21:56:13 -08:00
Paul Stack 6a68914fed
Moving away from deprecated GHA add-path and set-env (#5769) 2020-11-17 01:05:28 +00:00
Justin Van Patten 594da1e95c
Fix plugin install failures on Windows (#5759)
When installing a plugin, previous versions of Pulumi extracted the
plugin tarball to a temp directory and then renamed the temp directory
to the final plugin directory. This was done to prevent concurrent
installs: if a process fails to rename the temp dir because the final
dir already exists, it means another process already installed the
plugin. Unfortunately, on Windows the rename operation often fails due
to aggressive virus scanners opening files in the temp dir.

In order to provide reliable plugin installs on Windows, we now extract
the tarball directly into the final directory, and use file locks to
prevent concurrent installs from toppling over one another.

During install, a lock file is created in the plugin cache directory
with the same name as the plugin's final directory but suffixed with
`.lock`. The process that obtains the lock is responsible for extracting
the tarball. Before it does that, it cleans up any previous temp
directories of failed installs of previous versions of Pulumi. Then it
creates an empty `.partial` file next to the `.lock` file. The
`.partial` file indicates an installation is in-progress. The `.partial`
file is deleted when installation is complete, indicating the plugin was
successfully installed. If a failure occurs during installation, the
`.partial` file will remain indicating the plugin wasn't fully
installed. The next time the plugin is installed, the old installation
directory will be removed and replaced with a fresh install.

This is the same approach Go uses for installing modules in its
module cache.
2020-11-16 09:44:29 -08:00
Mikhail Shilkov b200e171a6
Update .NET Grpc to the latest and Protobuf to Pulumi fork (#5757) 2020-11-14 14:25:38 +01:00
Paul Stack 50725543a0
Ensure resource docs have a newline after description but before examples to render correctly (#5762) 2020-11-14 00:20:33 +00:00
Mikhail Shilkov 66c5cdb7a1
Parse string arrays from env in Go first-class provider (#5744) 2020-11-13 10:59:41 +01:00
Vivek Lakshmanan 9d6e380680
Merge pull request #5741 from pulumi/vl/GoVersion
Pulumi-language-go and pulumi new now checks go version is at least 1.14.0
2020-11-12 15:40:57 -08:00
Pat Gavlin 1e0c9efdd7
Respect provider config secretness. (#5742)
Just what it says on the tin. This is implemented by changing the
`GetPackageConfig` method of `ConfigSource` to return a `PropertyMap`
and ensuring that any secret config is represented by a `Secret`.
2020-11-12 12:18:12 -08:00
Paul Stack fe96365e6e
Including the legacy windows AWS env vars for windows pushes (#5748) 2020-11-12 11:58:47 -08:00
Vivek Lakshmanan b2e2562427 Fix test 2020-11-12 09:20:33 -08:00
Vivek Lakshmanan bcb9d0f4c8 Refactor to add version check to pulumi new as well 2020-11-12 09:20:28 -08:00
Vivek Lakshmanan f3b41e038e Pulumi-language-go now checks go version is atleast 1.14.0 2020-11-11 15:39:34 -08:00
Komal e3725a6e40
Support python 3.9 on windows (#5739) 2020-11-11 14:07:59 -08:00