Commit graph

1726 commits

Author SHA1 Message Date
Pat Gavlin b14bc09b1c
Update a misleading comment. (#8491) 2021-11-24 10:37:08 -08:00
Fraser Waters 09b7aa9186
Add String and GoString to Result (#8490)
I got fed up of assert errors in tests that looked like:
```
Expected nil, but got: &result.simpleResult{err:(*errors.fundamental)(0xc0002fa5d0)}
```

It was very hard to work out at a glance what had gone wrong and I kept
having to hook a debugger just to look at what the error was.

With GoString these now print something like:
```
Expected nil, but got: &simpleResult{err: Unexpected diag message: <{%reset%}>resource violates plan: properties changed: -zed, -baz, -foo<{%reset%}>
}
```

Which is much more useful.
2021-11-24 17:01:55 +00:00
Ian Wahbe 4029a1c89b
iwahbe/8474/dont serialize unknown values (#8475)
* Don't serialize unknown values

* Add test

* Update CHANGELOG_PENDING.md
2021-11-22 12:40:17 -08:00
Ian Wahbe d9dd88c740
Add tsconfig option to specify tsconfig path (#8452)
* Add tsconfig option to specify tsconfig path

* Add CHANGELOG entry and fix lint

* Add a test

* Fix test
2021-11-22 11:42:39 -08:00
Anton Tayanovskyy 574a6a104d
Do not FailNow() in generators (#8469) 2021-11-19 20:39:11 -05:00
Ian Wahbe 87d8c7f074
[sdk/pthon] Version Check: Handle virtual env correctly (#8465)
* Handle virtual env correctly

* Add CHANGELOG entry

* Correctly display which version is EOL
2021-11-19 15:21:13 -08:00
Ian Wahbe 7222e5570a
[cli] check main after master (#8463)
* Allow specifying a branch with url#branch

* Probe for master and main

* Update CHANGELOG

* Fix linter errors

* Remove unnecessary feature

* Fix lint

* Update changelog to reflect new limited scope.

We only talk about the master -> main probing, because that is all the
PR does. It used to duplicate another feature.
2021-11-19 13:49:59 -08:00
Ian Wahbe b9f57bc6b9
Move /opt/pulumi to $HOME/.pulumi (#8437)
* Move `/opt/pulumi` to `$HOME/.pulumi`

* Don't suggest adding $HOME/.pulumi to PATH
2021-11-17 10:37:38 -08:00
Luke Hoban ed769377dc
[sdk/python] Avoid 'referenced before assignment' error (#7135)
We have seen cases where a lot of errors like this are reported:

```
UnboundLocalError: local variable 'resources' referenced before assignment
```

This change prevents this failure mode, which might be a symptom of some
other issue, but currently obscures it in the error path.
2021-11-16 13:57:09 -08:00
Justin Van Patten ba39ed9ad4
Add tests that return failures from Call (#8424)
- [sdk/nodejs] - Allow returning failures from Call in the provider without setting result outputs.
- [sdk/go] - Allow specifying Call failures from the provider.
- Add tests that return failures from Call.
2021-11-16 08:58:46 -08:00
Emiliza Gutierrez a7783f26de
Fixing broken lists in dotnet docs (#8178)
* Fixing broken lists in dotnet docs

* update changelog
2021-11-15 17:40:19 -08:00
Anton Tayanovskyy 372ddc7e5c
Skip flaky tests for now (#8420) 2021-11-15 15:17:20 -05:00
Justin Van Patten 10ceee406e
[sdk/nodejs] Unmarshal output values in component provider (#8205)
This adds support for unmarshaling output values in the Node.js provider.
2021-11-15 11:22:44 -08:00
Ian Wahbe d3b2dedd1d
[sdk/python] Unmarshal output values in component providers (#8212) 2021-11-15 10:12:12 -08:00
Adam Wilczek a5f72ddbeb
Added a buildkite detector for detecting the correct env vars in CI (#7933)
* Added a buildkite detector for detecting the correct env vars in CI

* adding pending changelog entry

* fixed PR logic to actually match the Buildkite Docs and simplified if statement, Fixed a few typos in comments and added PR to CHANGELOG_PENDING.md

* made PR number fetch easier to read

* fixing typo in comment
2021-11-15 09:10:07 -08:00
Ian Wahbe 164a2ec818
Enable output marshaling in .NET (#8316) 2021-11-12 14:58:34 -08:00
Paul Stack 74ba28ad55
[CLI] Adding the ability to create a default org for backends that support orgs (#8352) 2021-11-12 20:44:51 +02:00
Ian Wahbe fbeac6fc10
Improve corrupt workspace settings experience (#8393)
* Improve corrupt workspace settings experience

This improvement comes in two parts.

1. The error message for a corrupt workspace settings file now clearly
indicates both the file and the parsing error.

2. Writing the workspace settings is now atomic. This prevents
corruption from multiple concurrent calls.

* Use builtin atomic write

* Use builtin ioutil.TempFile

* Change tmp file dir
2021-11-11 14:58:39 -08:00
Fraser Waters c6240cf38d
Improve vscode dotnet support (#8384)
* Run make ensure on devcontainer creation

Added an ensure target to the dotnet makefile to run `dotnet restore`.

* Add dotnet test explorer and set default vscode settings for it

* Ensure PULUMI_LOCAL_NUGET exists

* Add missing mkdirs
2021-11-11 20:40:18 +00:00
Ian Wahbe 6057dc3362
Validate python version (#8368)
* Validate python version

Note: we do this at the language plugin level because extremely old
version of python (python2) have different syntax, and we don't want
parse errors to occlude our version message. Similarly, if we rely on a
3.7 feature during an import, we will have the same problem. 

* Set minimum python version to 3.7.0

* Fix displayed recommended version
2021-11-09 14:22:16 -08:00
Komal 9a30f36c93
[auto/python] - Fix deserialization of event (#8375)
Fixes the deserialization for the `metadata` property on `ResourcePreEvent`, `ResOutputsEvent` and `ResOpFailedEvent`.
2021-11-08 13:05:04 -08:00
Anton Tayanovskyy e37892ac4a
Fix 8322 (#8339)
* Fix 8322

* Untabify

* Untabify again

* Yet More untabify

* More untabify

* Final untabify

* Add CHANGELOG_PENDING

* Apply suggestions from code review

Co-authored-by: Justin Van Patten <jvp@justinvp.com>

* PR feedback

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2021-11-08 10:45:26 -05:00
Anton Tayanovskyy 99fdad0ed9
Fix python dependencies issues in GHA (#8361) 2021-11-06 00:55:17 -07:00
Fraser Waters b58c39476f
Fix cmdutil.PrintTable to handle ansi escapes and non-byte glyphs (#8344)
Fixes two bugs in how padding was calculated in PrintTable.

Firstly we remove all ANSI escape codes from the string before measuring
how wide it is. Secondly we measure glyph count (using rivo/uniseg) not
byte or rune count of the string.

Together these fix the padding/alignment issues I saw when using
PrintTable with plan output. They also slightly change the layout of
"pulumi stack", for example the below is printed with current master and
has 6 characters of space for padding between SecurityGroup and
web-secgrp:

```
Current stack resources (4):
    TYPE                                        NAME
    pulumi:pulumi:Stack                         aws-cs-webserver-test
    ├─ aws:ec2/securityGroup:SecurityGroup      web-secgrp
    ├─ aws:ec2/instance:Instance                web-server-www
    └─ pulumi:providers:aws                     default_4_25_0
```

While printed with this commit you only get 2 characters of space for
padding (which is correct, the column gap is set to "  "):
```
Current stack resources (4):
    TYPE                                    NAME
    pulumi:pulumi:Stack                     aws-cs-webserver-test
    ├─ aws:ec2/securityGroup:SecurityGroup  web-secgrp
    ├─ aws:ec2/instance:Instance            web-server-www
    └─ pulumi:providers:aws                 default_4_25_0
```
2021-11-04 10:06:20 +00:00
Justin Van Patten f989e1cc9d
Update pkg -> sdk dependency (#8346) 2021-11-03 11:25:20 -07:00
Emiliza Gutierrez d243efae19
Revert "[python/sdk] - Remove python 3.6 support (#8161)" (#8332)
This reverts commit 895ae970ac.
2021-11-02 10:19:01 -07:00
Ian Wahbe e629bc32d5
Expand dependencies when marshaling output values (#8301)
* Expand dependencies when marshaling output values

[sdk/python]

* Update CHANGELOG_PENDING.md

* Use existing code

* Fix lint
2021-11-01 11:10:27 -07:00
Fraser Waters d39a14432f
Don't throw on type mismatches in the dotnet sdk (#8286)
* Don't throw on type mismatches in the dotnet sdk

Fixes #7329

The converter will no longer throw if resource providers return data
that does not match the expected type declared in the dotnet sdk.
Instead a warning will be logged for the resource and the value will be
set to `default(T)`.
2021-10-29 17:35:17 +01:00
Fraser Waters e71fd81fe8
Type inference for out var differs by compiler (#8312)
While our CI seems happy with this line of code on master, my machine
with the 3.1 sdk is resolving it to non-nullable type and complaining
about the "= null" line later.

```
LocalWorkspace.cs(389,27): error CS8600: Converting null literal or
possible null value to non-nullable type.
[/workspaces/pulumi/sdk/dotnet/Pulumi.Automation/Pulumi.Automation.csproj]
```

Quick fix to just not use "var" here.
2021-10-29 16:29:45 +01:00
Ian Wahbe e38876f7af
[sdk/go] Respect default parent in go aliases. (#8288)
* Respect default parent in go aliases.

* Update changelog

* Handle empty parrents correctly

* Allow specifying no parent

* clarify variable name

* Improve `Unparent` ergonomics

* Take t0yv0's suggestion

* Adopt @t0yv0's tests and doc comments.

* Make NoParent,Parent,ParentURN mutually exclusive
2021-10-28 17:25:31 -07:00
Ian Wahbe 83e24765f3
.NET & python SDKs parity for bad pulumi versions (#8297)
* .NET & python SDKs parity for bad pulumi versions

They handle invalid Pulumi CLI version gracefully.

* Make python version property lazy

* Clarify .NET logic

* Add python test for validate_pulumi_version

* Add tests for invalid versions

* Fix python test

* Fix typo

* Fix tests

* Have _validate_pulumi_version handle parsing

* Modify python and .NET to parseAndValidate

* Modify typescript and go to parseAndValidate

* fix name
2021-10-27 20:54:23 -07:00
Komal 895ae970ac
[python/sdk] - Remove python 3.6 support (#8161) 2021-10-27 10:35:46 -07:00
Justin Van Patten fbf62399ca
[sdk/go] Fix regression marshaling assets/archives (#8290)
This change fixes a regression marshaling assets/archives that was introduced after adding support for marshaling output values.

For example, when setting an `Asset` on a field typed as `AssetOrAchiveInput`, in `marshalInput`, the input was being converted into an `AssetOrArchiveOutput` via the `ToAssetOrArchiveOutputWithContext`. Awaiting the output returns an `*asset` struct, which is itself an `AssetInput`, which causes infinite recursion when passed recursively to `marshalInput`.

The fix is to skip the `Input` checks in recursive calls, which is equivalent to the previous behavior before the regression was introduced.

Another issue was that when the input is converted to an output, this would result in `marshalInput` always returning an output value, even if the original passed-in value was not an output. To address this, if the output's value is known, not a secret, and has no dependencies, we can return the value itself rather than wrapping it as an output.
2021-10-27 08:44:42 -07:00
Ian Wahbe c8e117a37d
Handle invalid Pulumi CLI version (#8289)
* Handle invalid Pulumi CLI version

* Add clarifying comments and improve error message.

* Update go version of `validatePulumiVersion`
2021-10-26 16:20:45 -07:00
Fraser Waters a199ba8bb5
Fix race condition in TaskMonitoringHelper (#8294)
* Fix race condition in TaskMonitoringHelper

Fixes #8163

TaskMonitoringHelper was using two seperate trackers for Idle and
FirstException and then calling WhenAny on both to see which state
happened first. This was racy as you could end up completing a task with
an exception but getting the idle tracker fire first, resulting in
TaskMonitoringHelper thinking no exception had happened.

I've combined the two trackers into TaskMonitoringHelper now. At each
task completion we check for exceptions and then idleness.

* Add changelog
2021-10-26 22:37:47 +01:00
Carlos Tadeu Panato Junior 1c0a7e4907
reformat error message string (#8284)
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
2021-10-26 14:55:25 -06:00
Fraser Waters b39c81e4cb
Improve error message and add test for #1440 (#8268)
* Improve error message and add test for #1440

* lint

* lint

* Use %w instead of errors.Wrap
2021-10-26 16:55:52 +01:00
Liam White 6e3e17ef28
Enable workaround for Yarn workspaces for inline functions (#8215)
See https://github.com/pulumi/pulumi/issues/2661\#issuecomment-939531284 for context.

Bascially, yarn workspaces rely on symlinks for monorepo-local packages.

I think this also resolves https://github.com/pulumi/pulumi/issues/2980

Signed-off-by: Liam White <liam@tetrate.io>
2021-10-25 10:13:09 -07:00
Josh Studt caf5fcd525
[auto/dotnet] - pulumi state delete & unprotect functionality (#8202)
Co-authored-by: Komal <komal@pulumi.com>
2021-10-18 16:26:45 -07:00
Ian Wahbe e07d96af9e
Pin grpc version (#8214) 2021-10-13 13:44:55 -07:00
iamjekyun 1bb85ca98c
Only prune the trailing spaces in Python automation result (#8160) 2021-10-11 10:26:22 -07:00
Ian Wahbe 20287afdd7
Iwahbe/8000/uprgade go versions (#8171)
* Upgrade the pulumi cli to go1.17.1

* Run go mod tidy

* Update CHANGELOG_PENDING.md

* Update pkg/go.mod for go1.17

* Update sdk and tests
2021-10-11 09:47:08 -07:00
Komal a9a62bd761
Determine secretness by checking raw string for the secret sentinel (#8179) 2021-10-08 14:43:10 -07:00
Anton Tayanovskyy 32695f7022
Minimally extend .NET SDK to support 5758 (#8142)
* Minimally extend .NET SDK to support 5758

* Retract CodegenUtilities

* Add CHANGELOG_PENDING
2021-10-07 09:51:24 -04:00
Komal b6c6108edd
[sdk/python] - Python 3.10 compatibility (#8130) 2021-10-05 11:43:52 -07:00
alexander-minchin 43f73f2cc1
Fix typo in Output.apply docstring (#8133) 2021-10-04 18:06:43 -07:00
Jeremy Dartigalongue 25f396bf49
Fix Go automation API --target / --replace args (#8109) 2021-10-04 11:55:23 -07:00
Anton Tayanovskyy 836b410911
Disable ConcurrentUpdateError test (#7953)
* Better logging from ConcurrentUpdateError test

* Disable the test
2021-10-04 13:31:31 -04:00
Pat Gavlin 4eec3b7e1b
[sdk/python] Add a smoke test for output deps (#8113)
Ensure that output property dependencies are deserialized and translated
properly.

Fixes #7444.

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2021-10-02 09:06:11 -07:00
Praneet Loke 8f89ab6e3a
[codegen/docs] Generate a package tree that can be serialized as JSON (#8102)
* Add an initialize func. Add a new func that generates the package tree
2021-09-30 17:35:44 -07:00