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

Disable auto stack parenting #11272

Merged
merged 1 commit into from Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
@@ -1,5 +1,5 @@
{
"go.buildTags": "all,smoke",
"go.buildTags": "all",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this makes sense, since the tests are !smoke. Whoops.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just got fed up of having to change this all the time to be able to run tests in vscode, I don't think it will have affected CI in any way.

"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
// }
//}
AaronFriel marked this conversation as resolved.
Show resolved Hide resolved
}
}

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