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
pulumi about
outputs the fully qualified stack reference
#11387
Conversation
Changelog[uncommitted] (2022-11-29)Features
|
feae2e6
to
44aa2d4
Compare
pkg/cmd/pulumi/about.go
Outdated
result.StackReference = fmt.Sprintf("%v/%v/%v", parts[0], proj.Name, parts[1]) | ||
} else if result.CurrentStack != nil && result.Backend != nil { | ||
// the stack name is $stack with the current user as the org | ||
result.StackReference = fmt.Sprintf("%v/%v/%v", result.Backend.User, proj.Name, result.CurrentStack.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't correct for filestate, also we should probably just ask the StackReference for the qualified name, rather than trying to reconstruct it.
Something like FullyQualifiedName() tokens.QName
, which for filestate just returns the same as Name but for httpstate returns the full name regardless of the current defaults for org and project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still want to implement stack refs for filestate, so for now would it be OK for filestate stacks (localBackend
) to return nil or ""
while we decide on how to handle the org?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've implemented this and (overdue? or duplicate?) opened #11390 so we can formally decide on this.
For local backends, we just don't render a fully qualified stack name.
44aa2d4
to
3b6bbc8
Compare
@iwahbe @Frassle I made the change suggested to add It looks like filestate backends aren't supported in |
What? They definitely are:
|
1dbd84d
to
c0c0455
Compare
if stackName != current.FullyQualifiedName { | ||
stackName += fmt.Sprintf(" (fully qualified to %q)", current.FullyQualifiedName) | ||
} | ||
return fmt.Sprintf("Current Stack: %s\n\n%s\n%s", stackName, resources, pending) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this prints like:
Current Stack: stack (fully qualified to org/proj/stack)
I wonder if the "fully qualified to" text is needed. I wonder if the non-qualified name is even needed if we're doing a text print, like we clearly want to keep it as is for the json case but maybe this should just always print the fully qualified name now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll just print out the FQN if it exists.
7dbc0a6
to
23608c2
Compare
bors r+ |
Build succeeded: |
Resolves #11386
When there is no valid stack, the
currentStack
value isnull
.Due to an existing bug, when the backend is filestate the
currentStack
value isnull
. It appears on filestate backends we do not render the current stack.