mirror of https://github.com/pulumi/pulumi.git
948bb36e7e
These changes add support for passing source position information in gRPC metadata and recording the source position that corresponds to a resource registration in the statefile. Enabling source position information in the resource model can provide substantial benefits, including but not limited to: - Better errors from the Pulumi CLI - Go-to-defintion for resources in state - Editor integration for errors, etc. from `pulumi preview` Source positions are (file, line) or (file, line, column) tuples represented as URIs. The line and column are stored in the fragment portion of the URI as "line(,column)?". The scheme of the URI and the form of its path component depends on the context in which it is generated or used: - During an active update, the URI's scheme is `file` and paths are absolute filesystem paths. This allows consumers to easily access arbitrary files that are available on the host. - In a statefile, the URI's scheme is `project` and paths are relative to the project root. This allows consumers to resolve source positions relative to the project file in different contexts irrespective of the location of the project itself (e.g. given a project-relative path and the URL of the project's root on GitHub, one can build a GitHub URL for the source position). During an update, source position information may be attached to gRPC calls as "source-position" metadata. This allows arbitrary calls to be associated with source positions without changes to their protobuf payloads. Modifying the protobuf payloads is also a viable approach, but is somewhat more invasive than attaching metadata, and requires changes to every call signature. Source positions should reflect the position in user code that initiated a resource model operation (e.g. the source position passed with `RegisterResource` for `pet` in the example above should be the source position in `index.ts`, _not_ the source position in the Pulumi SDK). In general, the Pulumi SDK should be able to infer the source position of the resource registration, as the relationship between a resource registration and its corresponding user code should be static per SDK. Source positions in state files will be stored as a new `registeredAt` property on each resource. This property is optional. |
||
---|---|---|
.. | ||
README.md | ||
index.ts | ||
package.json | ||
tsconfig.json | ||
yarn.lock |
README.md
This test validates that changes we're making in @pulumi/pulumi will be side-by-side compatible with the 'latest' version of @pulumi/pulumi
that has already shipped.
If a change is made that is not compatible, then the process should be:
- Ensure that the change is absolutely what we want to make.
- Disable running this test.
- Commit the change and update the minor version of
@pulumi/pulumi
(i.e. from 0.17.x to 0.18.0). - Flow this change downstream, rev'ing the minor version of all downstream packages.
- Re-enable the test. Because there is now a new 'latest'
@pulumi/pulumi
, this test should pass.
Step '3' indicates that we've made a breaking change, and that if 0.18 is pulled in from any package, that it must be pulled in from all packages.
Step '4' is necessary so that people can pick a set of packages that all agree on using this new @pulumi/pulumi
version. While not necessary to rev the minor version of these packages, we still do so to make it clear that there is a significant change here, and that one should not move to it as readily as they would a patch update.