DEVOPS-2496 add max history setting (#12)

* add history_max setting

* update docs

* use suite for env test
This commit is contained in:
Colin Hoglund
2021-05-19 13:16:43 -04:00
committed by Colin Hoglund
parent a566ea0cf7
commit 8d450bbf7d
6 changed files with 98 additions and 55 deletions

View File

@@ -2,6 +2,7 @@ package run
import (
"fmt"
"github.com/pelotech/drone-helm3/internal/env"
)
@@ -22,6 +23,7 @@ type Upgrade struct {
force bool
atomic bool
cleanupOnFail bool
historyMax int
certs *repoCerts
createNamespace bool
skipCrds bool
@@ -46,6 +48,7 @@ func NewUpgrade(cfg env.Config) *Upgrade {
force: cfg.Force,
atomic: cfg.AtomicUpgrade,
cleanupOnFail: cfg.CleanupOnFail,
historyMax: cfg.HistoryMax,
certs: newRepoCerts(cfg),
createNamespace: cfg.CreateNamespace,
skipCrds: cfg.SkipCrds,
@@ -110,6 +113,9 @@ func (u *Upgrade) Prepare() error {
}
args = append(args, u.certs.flags()...)
// always set --history-max since it defaults to non-zero value
args = append(args, fmt.Sprintf("--history-max=%d", u.historyMax))
args = append(args, u.release, u.chart)
u.cmd = command(helmBin, args...)
u.cmd.Stdout(u.stdout)