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

Fix cloudBackendReference.String #9240

Merged
merged 6 commits into from Mar 24, 2022
Merged

Fix cloudBackendReference.String #9240

merged 6 commits into from Mar 24, 2022

Conversation

Frassle
Copy link
Member

@Frassle Frassle commented Mar 17, 2022

Description

cloudBackendReference.String didn't use the same logic for infering the default owner as cloudBackend.ParseStackReference. This was partically evident during pulumi stack select where if you had two stacks "user/foo" and "org/bar" then stack ls would print them as:

foo
org/bar

If you then set the workspace default-org stack ls would still print them in the same way. But when passing "foo" to ParseStackReference it would pick up the implicit owner of "org" not "user" (because the default-org is set), and then you'd get a an error that the stack you selected didn't exist.

String now matches ParseStackReference and checks if a default-org is set and elides that name, not the user name if so.

Fixes #9018

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@mikhailshilkov
Copy link
Member

Are there any scenarios when this can break users? Do you want to add some tests for String()? Also, a changelog entry would be nice.

@Frassle
Copy link
Member Author

Frassle commented Mar 18, 2022

Are there any scenarios when this can break users?

I don't think so, its only going to change for people using org set-default and I think the only difference that could effect people is pulumi stack --show-name will print differently but it should print in a way that is now parseable.

@Frassle
Copy link
Member Author

Frassle commented Mar 18, 2022

Do you want to add some tests for String()?

Testing these parts of the system is really awkward right now, but I plan on changing this around some more as part of the backend work and should be able to add tests then.

@mikhailshilkov
Copy link
Member

Testing these parts of the system is really awkward right now,

Could you expand on this? I guess I'm naive but why not create a cloudBackendReference and call a String() on it?

@Frassle
Copy link
Member Author

Frassle commented Mar 18, 2022

Could you expand on this? I guess I'm naive but why not create a cloudBackendReference and call a String() on it?

Because that needs a whole cloudBackend as well. I've got plans to simplify references such that that won't be needed.

Copy link
Member

@mikhailshilkov mikhailshilkov left a comment

Choose a reason for hiding this comment

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

LGTM

@Frassle Frassle merged commit 7576c0a into master Mar 24, 2022
@pulumi-bot pulumi-bot deleted the fraser/fixStackString branch March 24, 2022 14:27
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.

some pulumi stack-related commands don't work correctly with a default org set
2 participants