Merge remote-tracking branch 'origin/master' into help-by-default
This commit is contained in:
@@ -6,7 +6,10 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
const kubeConfigTemplate = "/root/.kube/config.tpl"
|
||||
const (
|
||||
kubeConfigTemplate = "/root/.kube/config.tpl"
|
||||
kubeConfigFile = "/root/.kube/config"
|
||||
)
|
||||
|
||||
// A Step is one step in the plan.
|
||||
type Step interface {
|
||||
@@ -28,13 +31,12 @@ func NewPlan(cfg Config) (*Plan, error) {
|
||||
runCfg: run.Config{
|
||||
HelmCommand: string(cfg.Command),
|
||||
Debug: cfg.Debug,
|
||||
KubeConfig: cfg.KubeConfig,
|
||||
Values: cfg.Values,
|
||||
StringValues: cfg.StringValues,
|
||||
ValuesFiles: cfg.ValuesFiles,
|
||||
Namespace: cfg.Namespace,
|
||||
Stdout: os.Stdout,
|
||||
Stderr: os.Stderr,
|
||||
Stdout: cfg.Stdout,
|
||||
Stderr: cfg.Stderr,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -68,6 +70,7 @@ func determineSteps(cfg Config) *func(Config) []Step {
|
||||
return &help
|
||||
default:
|
||||
switch cfg.DroneEvent {
|
||||
// Note: These events are documented in docs/upgrade_settings.yml. Any changes here should be reflected there.
|
||||
case "push", "tag", "deployment", "pull_request", "promote", "rollback":
|
||||
return &upgrade
|
||||
case "delete":
|
||||
@@ -82,7 +85,7 @@ func determineSteps(cfg Config) *func(Config) []Step {
|
||||
func (p *Plan) Execute() error {
|
||||
for i, step := range p.steps {
|
||||
if p.cfg.Debug {
|
||||
fmt.Fprintf(os.Stderr, "calling %T.Execute (step %d)\n", step, i)
|
||||
fmt.Fprintf(p.cfg.Stderr, "calling %T.Execute (step %d)\n", step, i)
|
||||
}
|
||||
|
||||
if err := step.Execute(p.runCfg); err != nil {
|
||||
@@ -142,6 +145,7 @@ func initKube(cfg Config) []Step {
|
||||
ServiceAccount: cfg.ServiceAccount,
|
||||
Token: cfg.KubeToken,
|
||||
TemplateFile: kubeConfigTemplate,
|
||||
ConfigFile: kubeConfigFile,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user