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:
@@ -3,6 +3,7 @@ package run
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/pelotech/drone-helm3/internal/env"
|
||||
"io"
|
||||
"os"
|
||||
"text/template"
|
||||
@@ -32,6 +33,19 @@ type kubeValues struct {
|
||||
Token string
|
||||
}
|
||||
|
||||
// NewInitKube creates a InitKube using the given Config and filepaths. No validation is performed at this time.
|
||||
func NewInitKube(cfg env.Config, templateFile, configFile string) *InitKube {
|
||||
return &InitKube{
|
||||
SkipTLSVerify: cfg.SkipTLSVerify,
|
||||
Certificate: cfg.Certificate,
|
||||
APIServer: cfg.APIServer,
|
||||
ServiceAccount: cfg.ServiceAccount,
|
||||
Token: cfg.KubeToken,
|
||||
TemplateFile: templateFile,
|
||||
ConfigFile: configFile,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute generates a kubernetes config file from drone-helm3's template.
|
||||
func (i *InitKube) Execute(cfg Config) error {
|
||||
if cfg.Debug {
|
||||
|
||||
Reference in New Issue
Block a user