-
Notifications
You must be signed in to change notification settings - Fork 212
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
feat(*): add upgrade action support #135
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/deislabs/porter/pkg/mixin/exec" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func buildUpgradeCommand(m *exec.Mixin) *cobra.Command { | ||
var opts struct { | ||
file string | ||
} | ||
cmd := &cobra.Command{ | ||
Use: "upgrade", | ||
Short: "Execute the upgrade functionality of this mixin", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return m.Upgrade(opts.file) | ||
}, | ||
} | ||
flags := cmd.Flags() | ||
flags.StringVarP(&opts.file, "file", "f", "", "Path to the script to execute") | ||
return cmd | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
package exec | ||
|
||
func (m *Mixin) Uninstall(commandFile string) error { | ||
err := m.LoadInstruction(commandFile) | ||
if err != nil { | ||
return err | ||
} | ||
return m.Execute() | ||
// re-use Install's logic | ||
return m.Install(commandFile) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In a follow-on PR, it's up for grabs to anyone (doesn't have to be you!) who would like to extract the logic from It's a bit confusing to see uninstall calling to install here. I know it's because exec is an odd-ball mixin. 😀 |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package exec | ||
|
||
func (m *Mixin) Upgrade(commandFile string) error { | ||
// re-use Install's logic | ||
return m.Install(commandFile) | ||
} |
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.
👍 Yay! Thank you for tidying this up. It sparks much joy