Skip to content

Commit

Permalink
Disable auto stack parenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Frassle committed Nov 7, 2022
1 parent 72f007f commit 64eb33c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
@@ -1,5 +1,5 @@
{
"go.buildTags": "all,smoke",
"go.buildTags": "all",
"go.testTimeout": "1h",
"gopls": {
// A couple of modules get copied as part of builds and this confuse gopls as it sees the module name twice, just ignore the copy in the build folders.
Expand Down
@@ -0,0 +1,4 @@
changes:
- type: fix
scope: engine
description: "Disable auto parenting to see if that fixes #10950."
1 change: 1 addition & 0 deletions pkg/engine/lifecycletest/pulumi_test.go
Expand Up @@ -4116,6 +4116,7 @@ func TestAdditionalSecretOutputs(t *testing.T) {

func TestDefaultParents(t *testing.T) {
t.Parallel()
t.Skipf("Default parents disabled due to https://github.com/pulumi/pulumi/issues/10950")

loaders := []*deploytest.ProviderLoader{
deploytest.NewProviderLoader("pkgA", semver.MustParse("1.0.0"), func() (plugin.Provider, error) {
Expand Down
21 changes: 16 additions & 5 deletions pkg/resource/deploy/step_generator.go
Expand Up @@ -140,11 +140,22 @@ func (sg *stepGenerator) checkParent(parent resource.URN, resourceType tokens.Ty
}
} else {
// Else try and set it to the root stack
for urn := range sg.urns {
if urn.Type() == resource.RootStackType {
return urn, nil
}
}

// TODO: It looks like this currently has some issues with state ordering (see
// https://github.com/pulumi/pulumi/issues/10950). Best I can guess is the stack resource is
// hitting the step generator and so saving it's URN to sg.urns and issuing a Create step but not
// actually getting to writing it's state to the snapshot. Then in parallel with this something
// else is causing a pulumi:providers:pulumi default provider to be created, this picks up the
// stack URN from sg.urns and so sets it's parent automatically, but then races the step executor
// to write itself to state before the stack resource manages to. Long term we want to ensure
// there's always a stack resource present, and so that all resources (except the stack) have a
// parent (this will save us some work in each SDK), but for now lets just turn this support off.

//for urn := range sg.urns {
// if urn.Type() == resource.RootStackType {
// return urn, nil
// }
//}
}
}

Expand Down
5 changes: 3 additions & 2 deletions tests/integration/integration_nodejs_test.go
Expand Up @@ -306,8 +306,9 @@ func TestStackParenting(t *testing.T) {
case "g":
assert.Equal(t, urns["f"], res.Parent)
case "default":
// Default providers should have the stack as a parent.
assert.Equal(t, stackRes.URN, res.Parent)
// Default providers should have the stack as a parent, but auto-parenting has been
// disabled so they won't have a parent for now.
assert.Equal(t, resource.URN(""), res.Parent)
default:
t.Fatalf("unexpected name %s", res.URN.Name())
}
Expand Down

0 comments on commit 64eb33c

Please sign in to comment.