Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure CLI doesn't panic when using pulumi watch and ComponentResources #5675

Merged
merged 1 commit into from
Nov 4, 2020

Conversation

stack72
Copy link
Contributor

@stack72 stack72 commented Nov 3, 2020

Fixes: #3432
Fixes: #5625

@pgavlin and I had a short convo about this and decided this was the best course of action

When using the following code:

import * as pulumi from "@pulumi/pulumi";

class LandingZone extends pulumi.ComponentResource {
    constructor(name: string, args: {}, opts?: pulumi.ComponentResourceOptions) {
        super("custom:LandingZone", name, args, opts);
        this.registerOutputs();
    }
};

const lz = new LandingZone("main", {});

The previous behaviour was:

▶ pulumi watch
Watching (dev):
19:49:26.191[                    ] Updating...
19:49:27.797[     watch-panic-dev] create pulumi:pulumi:Stack
19:49:29.166[     watch-panic-dev] done create pulumi:pulumi:Stack
19:49:29.415[                main] create custom:LandingZone
19:49:29.866[                main] done create custom:LandingZone
19:49:30.561[                    ] Update complete.
panic: fatal: An assertion has failed: Module member token 'custom:LandingZone' missing module member delimiter

goroutine 122 [running]:
github.com/pulumi/pulumi/sdk/v2/go/common/util/contract.failfast(...)
	/Users/runner/work/pulumi/pulumi/sdk/go/common/util/contract/failfast.go:23
github.com/pulumi/pulumi/sdk/v2/go/common/util/contract.Assertf(0xc000bb4900, 0x5912434, 0x38, 0xc000638c30, 0x1, 0x1)
	/Users/runner/work/pulumi/pulumi/sdk/go/common/util/contract/assert.go:33 +0x1a5
github.com/pulumi/pulumi/sdk/v2/go/common/tokens.ModuleMember.Module(0xc000bb49c0, 0x12, 0x0, 0x18)
	/Users/runner/work/pulumi/pulumi/sdk/go/common/tokens/tokens.go:192 +0xd2
github.com/pulumi/pulumi/sdk/v2/go/common/tokens.ModuleMember.Package(0xc000bb49c0, 0x12, 0x58b325f, 0x1)
	/Users/runner/work/pulumi/pulumi/sdk/go/common/tokens/tokens.go:187 +0x35
github.com/pulumi/pulumi/sdk/v2/go/common/tokens.Type.Package(0xc000bb49c0, 0x12, 0xc0007a6cf8, 0x4010af8)
	/Users/runner/work/pulumi/pulumi/sdk/go/common/tokens/tokens.go:227 +0x70
github.com/pulumi/pulumi/pkg/v2/operations.(*resourceOperations).getOperationsProvider(0xc000c901a0, 0x0, 0xc0008e6f01, 0x16, 0xc000000000)
	/Users/runner/work/pulumi/pulumi/pkg/operations/resources.go:252 +0x65
github.com/pulumi/pulumi/pkg/v2/operations.(*resourceOperations).GetLogs(0xc000c901a0, 0xc000b645a0, 0x0, 0x0, 0x5bd36e0, 0xc000b86320, 0x11dab888)
	/Users/runner/work/pulumi/pulumi/pkg/operations/resources.go:147 +0xb65
github.com/pulumi/pulumi/pkg/v2/operations.(*resourceOperations).GetLogs.func1(0xc000c901a0, 0xc000b86580, 0xc0005ad8c0, 0xc0005ad920)
	/Users/runner/work/pulumi/pulumi/pkg/operations/resources.go:175 +0x5f
created by github.com/pulumi/pulumi/pkg/v2/operations.(*resourceOperations).GetLogs
	/Users/runner/work/pulumi/pulumi/pkg/operations/resources.go:174 +0x1bb

The new behaviour is:

▶ pulumi watch
Watching (dev):
19:50:18.216[                    ] Updating...
19:50:21.557[                    ] Update complete.

It's important to note that pulumi logs looks as follows for the same stack even though the ComponentResource has been "deployed"

▶ pulumi logs
Collecting logs for stack dev since 2020-11-03T18:56:05.000Z.


@stack72 stack72 requested review from komalali and justinvp and removed request for komalali November 3, 2020 20:07
@stack72 stack72 self-assigned this Nov 3, 2020
@stack72
Copy link
Contributor Author

stack72 commented Nov 3, 2020

The lint step is failing for unrelated reasons that are fixed in #5669

This PR will be rebased on that and pick up the linting changes

@stack72
Copy link
Contributor Author

stack72 commented Nov 3, 2020

I will rebase this PR when @komalali is able to merge #5669 so we can get a full green test cycle!

@stack72 stack72 merged commit 056c82c into master Nov 4, 2020
@pulumi-bot pulumi-bot deleted the stack72/gh-3432 branch November 4, 2020 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

watch panics with component Panic during pulumi logs
4 participants