Initialize Steps with a NewSTEPNAME function [#67]
This seems to be be a more natural separation of concerns--the knowledge of which config fields map to which parts of a Step belong to the Step, not to the Plan.
This commit is contained in:
@@ -2,6 +2,7 @@ package run
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/pelotech/drone-helm3/internal/env"
|
||||
)
|
||||
|
||||
// Uninstall is an execution step that calls `helm uninstall` when executed.
|
||||
@@ -12,6 +13,15 @@ type Uninstall struct {
|
||||
cmd cmd
|
||||
}
|
||||
|
||||
// NewUninstall creates an Uninstall using fields from the given Config. No validation is performed at this time.
|
||||
func NewUninstall(cfg env.Config) *Uninstall {
|
||||
return &Uninstall{
|
||||
Release: cfg.Release,
|
||||
DryRun: cfg.DryRun,
|
||||
KeepHistory: cfg.KeepHistory,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the `helm uninstall` command.
|
||||
func (u *Uninstall) Execute(_ Config) error {
|
||||
return u.cmd.Run()
|
||||
|
||||
Reference in New Issue
Block a user