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:
Erin Call
2020-01-16 13:50:04 -08:00
parent 16117eea2f
commit 588c7cb9f7
16 changed files with 218 additions and 179 deletions

View File

@@ -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()