-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add --version flag to 'pulumi stack export' #3906
Conversation
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.
LGTM!
pkg/backend/backend.go
Outdated
@@ -189,6 +189,19 @@ type Backend interface { | |||
CurrentUser() (string, error) | |||
} | |||
|
|||
// SpecificDeploymentExporter is an interface that extends Backend, which adds the ability to export |
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 doesn't need to extend Backend
(it's generally idiomatic to keep interfaces as narrow as possible). LGTM otherwise.
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.
Done.
pkg/backend/httpstate/backend.go
Outdated
return b.exportDeployment(ctx, stack.Ref(), nil /* latest */) | ||
} | ||
|
||
func (b *cloudBackend) ExportSpecificDeployment( |
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.
Nit:
func (b *cloudBackend) ExportSpecificDeployment( | |
func (b *cloudBackend) ExportDeploymentForVersion( |
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.
Done.
f96dad8
to
7cf6e31
Compare
// SpecificDeploymentExporter is an interface defining an additional capability of a Backend, specifically the | ||
// ability to export a specific versions of a stack's deployment. This isn't a requirement for all backends and | ||
// should be checked for dynamically. | ||
type SpecificDeploymentExporter interface { |
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.
Tiny nit for consistency with the method name
type SpecificDeploymentExporter interface { | |
type VersionedDeploymentExporter interface { |
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.
LGTM aside from one v small nit
Add
--version
flag topulumi stack export
, which will request that the backend export an older version of the checkpoint rather than whatever is the "latest".This is implemented not by adding a new method to the
backend.Backend
interface, since we don't necessarily want to require this capability for all backends. (And would also cause some problems, such as missing data, for thefilestate
backend.) So I went with an approach where we extend the interface, and dynamically check if the backend supportsSpecificDeploymentExporter
. (If you are familiar with COM, this is kinda-sorta theIBackend2
type pattern.Examples of common errors:
Fixes #1910