Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
13265: Fix isInstance methods on generated provider types in the nodejs sdks r=abhinav 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 #12584

## 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
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] 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. -->


13316: Test duplicate outputs r=abhinav 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. -->

Regression test to cover #9411

## 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. -->
- [x] 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. -->


13323: [sdk/python] Fix comment about `ROOT_STACK_RESOURCE` r=abhinav a=justinvp

Looks like this was copied from the Node.js SDK. It should be `ROOT_STACK_RESOURCE` not `rootStackResource` for Python.

13326: ci: Include Go and NodeJS hosts in unit tests r=abhinav a=abhinav

The CI test matrix generator expects every module that we want to test
to be provided explicitly.
Since the Go and Node hosts became independent Go modules,
we haven't been running their unit tests in CI.

Fortunately, the tests still pass today,
but we need to include these in the build.


13327: ci/build-binaries: Don't enable cgo for Darwin r=abhinav a=abhinav

Previously, it was necessary to enable cgo
and use the system's DNS resolver on macOS.
In Go 1.20, the `net` package was rewritten
to not use cgo at all,
so CGO_ENABLED no longer has any effect there.

In fact, ever since 3898600,
this setting has been meaningless
because we've been building Darwin binaries
on Ubuntu machines (so cgo can't be enabled anyway).

This commit just deletes this now-unused block.


13334: ci(new workflow): Run tests on master every 12 hours r=abhinav a=abhinav

We recently started capturing coverage data for Pull Requests again
but we omitted tracking for master.

Part of the reason for this is that the our CI setup uses the same
binaries that were used for the end-to-end tests as part of the release.
And we don't want to upload the coverage-instrumented binaries for a
release.

This is fixable, but instead of making our CI set up even more complex,
this introduces a new workflow to test master periodically.

This workflow will run every 12 hours, running all tests on master,
with acceptance tests on both Windows and macOS,
track coverage for all of this, and post that to codecov.

We'll be able to track code coverage trends on master in Codecov.


Co-authored-by: Fraser Waters <fraser@pulumi.com>
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
  • Loading branch information
4 people committed Jun 30, 2023
7 parents c0c14fc + 84d4cc6 + 04ce92c + 62183dd + 7a5de3a + 2489599 + b7212d5 commit 11f3f1d
Show file tree
Hide file tree
Showing 56 changed files with 211 additions and 71 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -145,6 +145,8 @@ jobs:
--version-set current \
--partition-module pkg "$PKG_UNIT_TEST_PARTITIONS" \
--partition-module sdk 1 \
--partition-module sdk/go/pulumi-language-go 1 \
--partition-module sdk/nodejs/cmd/pulumi-language-nodejs 1 \
--partition-module tests 2
)
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/periodic-coverage.yml
@@ -0,0 +1,48 @@
# Periodically runs the tests on master and posts coverage results to codecov.

name: Test with coverage
on:
workflow_dispatch: {}
schedule:
# Run every 12 hours.
- cron: '0 */12 * * *'

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:

info:
name: info
uses: ./.github/workflows/ci-info.yml
permissions:
contents: read
with:
ref: master
is-snapshot: true
secrets: inherit

ci:
name: CI
needs: [info]
uses: ./.github/workflows/ci.yml
permissions:
contents: read
# To sign artifacts.
id-token: write
with:
ref: master
version: ${{ needs.info.outputs.version }}
lint: true
build-all-targets: true
test-codegen: true
test-version-sets: current
integration-test-platforms: ubuntu-latest
acceptance-test-platforms: macos-latest windows-latest
enable-coverage: true
secrets: inherit
@@ -0,0 +1,4 @@
changes:
- type: fix
scope: sdkgen/nodejs
description: Fix isInstance methods for generated provider types.
12 changes: 11 additions & 1 deletion pkg/codegen/nodejs/gen.go
Expand Up @@ -692,7 +692,17 @@ func (mod *modContext) genResource(w io.Writer, r *schema.Resource) (resourceFil
fmt.Fprintf(w, " if (obj === undefined || obj === null) {\n")
fmt.Fprintf(w, " return false;\n")
fmt.Fprintf(w, " }\n")
fmt.Fprintf(w, " return obj['__pulumiType'] === %s.__pulumiType;\n", name)

typeExpression := fmt.Sprintf("%s.__pulumiType", name)
if r.IsProvider {
// We pass __pulumiType to the ProviderResource constructor as the "type" for this provider, the
// ProviderResource constructor in the SDK then prefixes "pulumi:providers:" to that token and passes that
// down to the CustomResource constructor, which then assigns that type token to the newly constructed
// objects __pulumiType field. As such we also need to prefix "pulumi:providers:" when doing the equality
// check here.
typeExpression = "\"pulumi:providers:\" + " + typeExpression
}
fmt.Fprintf(w, " return obj['__pulumiType'] === %s;\n", typeExpression)
fmt.Fprintf(w, " }\n")
fmt.Fprintf(w, "\n")

Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -21,7 +21,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -21,7 +21,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -19,7 +19,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down
Expand Up @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}


Expand Down

0 comments on commit 11f3f1d

Please sign in to comment.