32 Commits

Author SHA1 Message Date
c017a87c4c Update Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-23 18:53:35 +03:00
f21e5bede0 Update Dockerfile
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/promote/production Build was killed
2025-08-23 18:50:38 +03:00
4896617402 Update .drone.yml
Some checks failed
continuous-integration/drone/push Build is failing
2025-08-23 18:49:56 +03:00
5b9ebfb2d8 Update Dockerfile
Some checks failed
continuous-integration/drone/push Build is failing
2025-08-23 18:49:21 +03:00
628f9d3ef6 upd
All checks were successful
continuous-integration/drone/push Build is passing
2025-06-26 21:20:53 +03:00
5a95211c2f Update Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing
2025-06-26 21:18:22 +03:00
b926404924 3.17
All checks were successful
continuous-integration/drone/push Build is passing
2025-04-09 16:02:07 +03:00
53104347c2 Update Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing
2024-12-23 18:36:49 +03:00
123c331889 Update Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing
2024-12-23 18:35:02 +03:00
9ce383cf2c upd
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-21 20:54:41 +03:00
06bf1b863c Update Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing
2024-02-20 19:50:00 +03:00
e656306216 Update Dockerfile
Some checks failed
continuous-integration/drone/push Build is failing
2024-02-20 19:48:58 +03:00
82ed33b180 Update .drone.yml
All checks were successful
continuous-integration/drone/push Build is passing
2024-02-20 19:46:38 +03:00
e4a1fa89fa Update .drone.yml
Some checks failed
continuous-integration/drone/push Build is failing
2024-02-20 19:43:22 +03:00
66e8afd9a4 Update .drone.yml
Some checks failed
continuous-integration/drone/push Build encountered an error
2024-02-20 19:40:31 +03:00
b1e18abf75 Update .drone.yml
Some checks failed
continuous-integration/drone/push Build encountered an error
2024-02-20 19:39:28 +03:00
5a725fd5c6 Update .drone.yml 2024-02-20 19:39:18 +03:00
cda07939db new helm 2024-02-20 19:37:18 +03:00
Joachim Hill-Grannec
7533ed95ad update for CGO 2022-08-23 10:11:21 -06:00
Joachim Hill-Grannec
98bb4e4ba4 explicitly target linux amd64 2022-08-23 09:31:37 -06:00
Joachim Hill-Grannec
e07eb1399b Merge pull request #112 from navi86/fix-folder-issue
fix issue
2022-08-23 08:07:59 -06:00
Ivan Krylov
9a9987eeb2 fix issue 2022-08-23 12:41:12 +01:00
Joachim Hill-Grannec
fed0a769f2 Update container maintainer 2022-08-22 09:58:59 -06:00
Joachim Hill-Grannec
48473bd9d8 Merge pull request #110 from mongodb-forks/contribute_historymax
Add `history_max` setting
2022-08-22 09:54:03 -06:00
Colin Hoglund
64045fadfb add comment 2022-08-16 11:44:57 -07:00
Colin Hoglund
c5a7551da8 unexport 2022-08-16 11:43:37 -07:00
Colin Hoglund
eeccfdd143 fix test 2022-08-16 11:42:02 -07:00
Colin Hoglund
8d450bbf7d DEVOPS-2496 add max history setting (#12)
* add history_max setting

* update docs

* use suite for env test
2022-08-16 11:37:13 -07:00
Joachim Hill-Grannec
a566ea0cf7 Merge pull request #108 from hobbypunk90/master
Update to helm 3.8.1
2022-07-08 00:48:40 -06:00
Marcel Hoppe
24f10ce1b9 Update to helm 3.8.1 2022-04-04 11:51:54 +02:00
Joachim Hill-Grannec
7c033a8b0a Merge pull request #104 from georgekaz/add-skip-crds
add skip-crds flag support
2021-07-21 08:10:35 -06:00
George Kaz
e482a144c1 add skip-crds flag support
Signed-off-by: George Kaz <egeorgekaz@gmail.com>
2021-07-20 19:26:00 +01:00
11 changed files with 192 additions and 92 deletions

View File

@@ -1,32 +1,36 @@
---
kind: pipeline kind: pipeline
type: docker type: kubernetes
name: default name: build
trigger:
branch:
- master
clone:
# disable: true
depth: 1
image_pull_secrets:
- dockerconfig
steps: steps:
- name: test
image: golang:1.13
commands:
- go test ./cmd/... ./internal/...
- go vet ./cmd/... ./internal/...
- name: lint
image: cytopia/golint
commands:
- golint -set_exit_status ./cmd/... ./internal/...
- name: build
image: golang:1.13
commands:
- go build -o build/drone-helm cmd/drone-helm/main.go
- name: publish_linux_amd64 - name: publish_linux_amd64
image: plugins/docker image: harbor.1sept.ru/drone/drone-kaniko
settings: settings:
auto_tag: true registry: harbor.1sept.ru
username: repo: drone/drone-helm3
from_secret: docker_username cache: false
password: tags:
from_secret: docker_password - git-${DRONE_COMMIT_SHA:0:7}
repo: - latest
from_secret: plugin_repo username:
dockerfile: Dockerfile from_secret: harbor-username
when: password:
event: [ tag, push ] from_secret: harbor-password
---
kind: signature
hmac: ab275b41f1621072152d6e85b5f94289be8dda38debd2a177e0f666960491c6e
...

1
.gitignore vendored
View File

@@ -20,3 +20,4 @@
.secrets .secrets
build/* build/*
**/.DS_Store

View File

@@ -1,10 +1,19 @@
FROM alpine/helm:3.2.4 FROM golang:1.24-alpine3.21 AS builder
MAINTAINER Erin Call <erin@liffft.com>
COPY build/drone-helm /bin/drone-helm ENV GO111MODULE=on
COPY assets/kubeconfig.tpl /root/.kube/config.tpl WORKDIR /app
LABEL description="Helm 3 plugin for Drone 3" COPY --link go.mod .
LABEL base="alpine/helm" COPY --link go.sum .
RUN go mod download
COPY --link . .
ENTRYPOINT [ "/bin/drone-helm" ] RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /go/bin/drone-helm ./cmd/drone-helm
# --- Copy the cli to an image with helm already installed ---
FROM alpine/helm:3.18.5
COPY --link --from=builder /go/bin/drone-helm /bin/drone-helm
COPY --link ./assets/kubeconfig.tpl /root/.kube/config.tpl
ENTRYPOINT [ "/bin/drone-helm" ]

9
Makefile Normal file
View File

@@ -0,0 +1,9 @@
help:
@echo "make check - Check Dockerfile syntax"
@echo "make drone-sign - Sign Drone config file"
check:
docker build --check .
drone-sign: ## Envs DRONE_SERVER & DRONE_TOKEN needed
drone sign --save 1sept/drone-helm3

View File

@@ -44,12 +44,14 @@ Installations are triggered when the `mode` setting is "upgrade." They can also
| force_upgrade | boolean | | force | Pass `--force` to `helm upgrade`. | | force_upgrade | boolean | | force | Pass `--force` to `helm upgrade`. |
| atomic_upgrade | boolean | | | Pass `--atomic` to `helm upgrade`. | | atomic_upgrade | boolean | | | Pass `--atomic` to `helm upgrade`. |
| cleanup_failed_upgrade | boolean | | | Pass `--cleanup-on-fail` to `helm upgrade`. | | cleanup_failed_upgrade | boolean | | | Pass `--cleanup-on-fail` to `helm upgrade`. |
| history_max | int | | | Pass `--history-max` to `helm upgrade`. |
| values | list\<string\> | | | Chart values to use as the `--set` argument to `helm upgrade`. | | values | list\<string\> | | | Chart values to use as the `--set` argument to `helm upgrade`. |
| string_values | list\<string\> | | | Chart values to use as the `--set-string` argument to `helm upgrade`. | | string_values | list\<string\> | | | Chart values to use as the `--set-string` argument to `helm upgrade`. |
| values_files | list\<string\> | | | Values to use as `--values` arguments to `helm upgrade`. | | values_files | list\<string\> | | | Values to use as `--values` arguments to `helm upgrade`. |
| reuse_values | boolean | | | Reuse the values from a previous release. | | reuse_values | boolean | | | Reuse the values from a previous release. |
| skip_tls_verify | boolean | | | Connect to the Kubernetes cluster without checking for a valid TLS certificate. Not recommended in production. This is ignored if `skip_kubeconfig` is `true`. | | skip_tls_verify | boolean | | | Connect to the Kubernetes cluster without checking for a valid TLS certificate. Not recommended in production. This is ignored if `skip_kubeconfig` is `true`. |
| create_namespace | boolean | | | Pass --create-namespace to `helm upgrade`. | | create_namespace | boolean | | | Pass --create-namespace to `helm upgrade`. |
| skip_crds | boolean | | | Pass --skip-crds to `helm upgrade`. |
## Uninstallation ## Uninstallation

View File

@@ -10,6 +10,10 @@ import (
"github.com/kelseyhightower/envconfig" "github.com/kelseyhightower/envconfig"
) )
const (
defaultHistoryMax = 10
)
var ( var (
justNumbers = regexp.MustCompile(`^\d+$`) justNumbers = regexp.MustCompile(`^\d+$`)
deprecatedVars = []string{"PURGE", "RECREATE_PODS", "TILLER_NS", "UPGRADE", "CANARY_IMAGE", "CLIENT_ONLY", "STABLE_REPO_URL"} deprecatedVars = []string{"PURGE", "RECREATE_PODS", "TILLER_NS", "UPGRADE", "CANARY_IMAGE", "CLIENT_ONLY", "STABLE_REPO_URL"}
@@ -45,6 +49,7 @@ type Config struct {
Wait bool `envconfig:"wait_for_upgrade"` // Pass --wait to applicable helm commands Wait bool `envconfig:"wait_for_upgrade"` // Pass --wait to applicable helm commands
ReuseValues bool `split_words:"true"` // Pass --reuse-values to `helm upgrade` ReuseValues bool `split_words:"true"` // Pass --reuse-values to `helm upgrade`
KeepHistory bool `split_words:"true"` // Pass --keep-history to `helm uninstall` KeepHistory bool `split_words:"true"` // Pass --keep-history to `helm uninstall`
HistoryMax int `split_words:"true"` // Pass --history-max option
Timeout string `` // Argument to pass to --timeout in applicable helm commands Timeout string `` // Argument to pass to --timeout in applicable helm commands
Chart string `` // Chart argument to use in applicable helm commands Chart string `` // Chart argument to use in applicable helm commands
Release string `` // Release argument to use in applicable helm commands Release string `` // Release argument to use in applicable helm commands
@@ -52,6 +57,7 @@ type Config struct {
AtomicUpgrade bool `split_words:"true"` // Pass --atomic to `helm upgrade` AtomicUpgrade bool `split_words:"true"` // Pass --atomic to `helm upgrade`
CleanupOnFail bool `envconfig:"cleanup_failed_upgrade"` // Pass --cleanup-on-fail to `helm upgrade` CleanupOnFail bool `envconfig:"cleanup_failed_upgrade"` // Pass --cleanup-on-fail to `helm upgrade`
LintStrictly bool `split_words:"true"` // Pass --strict to `helm lint` LintStrictly bool `split_words:"true"` // Pass --strict to `helm lint`
SkipCrds bool `split_words:"true"` // Pass --skip-crds to `helm upgrade`
Stdout io.Writer `ignored:"true"` Stdout io.Writer `ignored:"true"`
Stderr io.Writer `ignored:"true"` Stderr io.Writer `ignored:"true"`
@@ -78,6 +84,9 @@ func NewConfig(stdout, stderr io.Writer) (*Config, error) {
KubeToken: aliases.KubeToken, KubeToken: aliases.KubeToken,
Certificate: aliases.Certificate, Certificate: aliases.Certificate,
// set to same default as helm CLI
HistoryMax: defaultHistoryMax,
Stdout: stdout, Stdout: stdout,
Stderr: stderr, Stderr: stderr,
} }

View File

@@ -217,6 +217,15 @@ func (suite *ConfigTestSuite) TestValuesSecretsWithDebugLogging() {
suite.Contains(stderr.String(), `$SECRET_WATER not present in environment, replaced with ""`) suite.Contains(stderr.String(), `$SECRET_WATER not present in environment, replaced with ""`)
} }
func (suite *ConfigTestSuite) TestHistoryMax() {
conf := NewTestConfig(suite.T())
suite.Assert().Equal(10, conf.HistoryMax)
suite.setenv("PLUGIN_HISTORY_MAX", "0")
conf = NewTestConfig(suite.T())
suite.Assert().Equal(0, conf.HistoryMax)
}
func (suite *ConfigTestSuite) setenv(key, val string) { func (suite *ConfigTestSuite) setenv(key, val string) {
orig, ok := os.LookupEnv(key) orig, ok := os.LookupEnv(key)
if ok { if ok {

16
internal/env/testing.go vendored Normal file
View File

@@ -0,0 +1,16 @@
package env
import (
"os"
"testing"
"github.com/stretchr/testify/require"
)
// NewTestConfig is a helper for setting up a Config object and error checking
func NewTestConfig(t *testing.T) *Config {
conf, err := NewConfig(os.Stdout, os.Stderr)
require.NoError(t, err)
return conf
}

View File

@@ -3,10 +3,11 @@ package run
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/pelotech/drone-helm3/internal/env"
"io" "io"
"os" "os"
"text/template" "text/template"
"github.com/pelotech/drone-helm3/internal/env"
) )
// InitKube is a step in a helm Plan that initializes the kubernetes config file. // InitKube is a step in a helm Plan that initializes the kubernetes config file.
@@ -87,7 +88,7 @@ func (i *InitKube) Prepare() error {
fmt.Fprintf(i.stderr, "kubeconfig file at %s\n", i.configFilename) fmt.Fprintf(i.stderr, "kubeconfig file at %s\n", i.configFilename)
} }
i.configFile, err = os.Create(i.configFilename) i.configFile, err = os.OpenFile(i.configFilename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil { if err != nil {
return fmt.Errorf("could not open kubeconfig file for writing: %w", err) return fmt.Errorf("could not open kubeconfig file for writing: %w", err)
} }

View File

@@ -2,6 +2,7 @@ package run
import ( import (
"fmt" "fmt"
"github.com/pelotech/drone-helm3/internal/env" "github.com/pelotech/drone-helm3/internal/env"
) )
@@ -22,8 +23,10 @@ type Upgrade struct {
force bool force bool
atomic bool atomic bool
cleanupOnFail bool cleanupOnFail bool
historyMax int
certs *repoCerts certs *repoCerts
createNamespace bool createNamespace bool
skipCrds bool
cmd cmd cmd cmd
} }
@@ -45,8 +48,10 @@ func NewUpgrade(cfg env.Config) *Upgrade {
force: cfg.Force, force: cfg.Force,
atomic: cfg.AtomicUpgrade, atomic: cfg.AtomicUpgrade,
cleanupOnFail: cfg.CleanupOnFail, cleanupOnFail: cfg.CleanupOnFail,
historyMax: cfg.HistoryMax,
certs: newRepoCerts(cfg), certs: newRepoCerts(cfg),
createNamespace: cfg.CreateNamespace, createNamespace: cfg.CreateNamespace,
skipCrds: cfg.SkipCrds,
} }
} }
@@ -100,11 +105,17 @@ func (u *Upgrade) Prepare() error {
if u.createNamespace { if u.createNamespace {
args = append(args, "--create-namespace") args = append(args, "--create-namespace")
} }
if u.skipCrds {
args = append(args, "--skip-crds")
}
for _, vFile := range u.valuesFiles { for _, vFile := range u.valuesFiles {
args = append(args, "--values", vFile) args = append(args, "--values", vFile)
} }
args = append(args, u.certs.flags()...) 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) args = append(args, u.release, u.chart)
u.cmd = command(helmBin, args...) u.cmd = command(helmBin, args...)
u.cmd.Stdout(u.stdout) u.cmd.Stdout(u.stdout)

View File

@@ -2,11 +2,12 @@ package run
import ( import (
"fmt" "fmt"
"strings"
"testing"
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
"github.com/pelotech/drone-helm3/internal/env" "github.com/pelotech/drone-helm3/internal/env"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"strings"
"testing"
) )
type UpgradeTestSuite struct { type UpgradeTestSuite struct {
@@ -33,23 +34,23 @@ func TestUpgradeTestSuite(t *testing.T) {
} }
func (suite *UpgradeTestSuite) TestNewUpgrade() { func (suite *UpgradeTestSuite) TestNewUpgrade() {
cfg := env.Config{ cfg := env.NewTestConfig(suite.T())
ChartVersion: "seventeen", cfg.ChartVersion = "seventeen"
DryRun: true, cfg.DryRun = true
Wait: true, cfg.Wait = true
Values: "steadfastness,forthrightness", cfg.Values = "steadfastness,forthrightness"
StringValues: "tensile_strength,flexibility", cfg.StringValues = "tensile_strength,flexibility"
ValuesFiles: []string{"/root/price_inventory.yml"}, cfg.ValuesFiles = []string{"/root/price_inventory.yml"}
ReuseValues: true, cfg.ReuseValues = true
Timeout: "go sit in the corner", cfg.Timeout = "go sit in the corner"
Chart: "billboard_top_100", cfg.Chart = "billboard_top_100"
Release: "post_malone_circles", cfg.Release = "post_malone_circles"
Force: true, cfg.Force = true
AtomicUpgrade: true, cfg.AtomicUpgrade = true
CleanupOnFail: true, cfg.CleanupOnFail = true
}
up := NewUpgrade(*cfg)
up := NewUpgrade(cfg)
suite.Equal(cfg.Chart, up.chart) suite.Equal(cfg.Chart, up.chart)
suite.Equal(cfg.Release, up.release) suite.Equal(cfg.Release, up.release)
suite.Equal(cfg.ChartVersion, up.chartVersion) suite.Equal(cfg.ChartVersion, up.chartVersion)
@@ -70,15 +71,15 @@ func (suite *UpgradeTestSuite) TestNewUpgrade() {
func (suite *UpgradeTestSuite) TestPrepareAndExecute() { func (suite *UpgradeTestSuite) TestPrepareAndExecute() {
defer suite.ctrl.Finish() defer suite.ctrl.Finish()
cfg := env.Config{ cfg := env.NewTestConfig(suite.T())
Chart: "at40", cfg.Chart = "at40"
Release: "jonas_brothers_only_human", cfg.Release = "jonas_brothers_only_human"
}
u := NewUpgrade(cfg) u := NewUpgrade(*cfg)
command = func(path string, args ...string) cmd { command = func(path string, args ...string) cmd {
suite.Equal(helmBin, path) suite.Equal(helmBin, path)
suite.Equal([]string{"upgrade", "--install", "jonas_brothers_only_human", "at40"}, args) suite.Equal([]string{"upgrade", "--install", "--history-max=10", "jonas_brothers_only_human", "at40"}, args)
return suite.mockCmd return suite.mockCmd
} }
@@ -99,16 +100,16 @@ func (suite *UpgradeTestSuite) TestPrepareAndExecute() {
func (suite *UpgradeTestSuite) TestPrepareNamespaceFlag() { func (suite *UpgradeTestSuite) TestPrepareNamespaceFlag() {
defer suite.ctrl.Finish() defer suite.ctrl.Finish()
cfg := env.Config{ cfg := env.NewTestConfig(suite.T())
Namespace: "melt", cfg.Namespace = "melt"
Chart: "at40", cfg.Chart = "at40"
Release: "shaed_trampoline", cfg.Release = "shaed_trampoline"
}
u := NewUpgrade(cfg) u := NewUpgrade(*cfg)
command = func(path string, args ...string) cmd { command = func(path string, args ...string) cmd {
suite.Equal(helmBin, path) suite.Equal(helmBin, path)
suite.Equal([]string{"--namespace", "melt", "upgrade", "--install", "shaed_trampoline", "at40"}, args) suite.Equal([]string{"--namespace", "melt", "upgrade", "--install", "--history-max=10", "shaed_trampoline", "at40"}, args)
return suite.mockCmd return suite.mockCmd
} }
@@ -123,22 +124,22 @@ func (suite *UpgradeTestSuite) TestPrepareNamespaceFlag() {
func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() { func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
defer suite.ctrl.Finish() defer suite.ctrl.Finish()
cfg := env.Config{ cfg := env.NewTestConfig(suite.T())
Chart: "hot_ac", cfg.Chart = "hot_ac"
Release: "maroon_5_memories", cfg.Release = "maroon_5_memories"
ChartVersion: "radio_edit", cfg.ChartVersion = "radio_edit"
DryRun: true, cfg.DryRun = true
Wait: true, cfg.Wait = true
Values: "age=35", cfg.Values = "age=35"
StringValues: "height=5ft10in", cfg.StringValues = "height=5ft10in"
ValuesFiles: []string{"/usr/local/stats", "/usr/local/grades"}, cfg.ValuesFiles = []string{"/usr/local/stats", "/usr/local/grades"}
ReuseValues: true, cfg.ReuseValues = true
Timeout: "sit_in_the_corner", cfg.Timeout = "sit_in_the_corner"
Force: true, cfg.Force = true
AtomicUpgrade: true, cfg.AtomicUpgrade = true
CleanupOnFail: true, cfg.CleanupOnFail = true
}
u := NewUpgrade(cfg) u := NewUpgrade(*cfg)
// inject a ca cert filename so repoCerts won't create any files that we'd have to clean up // inject a ca cert filename so repoCerts won't create any files that we'd have to clean up
u.certs.caCertFilename = "local_ca.cert" u.certs.caCertFilename = "local_ca.cert"
@@ -158,6 +159,7 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
"--values", "/usr/local/stats", "--values", "/usr/local/stats",
"--values", "/usr/local/grades", "--values", "/usr/local/grades",
"--ca-file", "local_ca.cert", "--ca-file", "local_ca.cert",
"--history-max=10",
"maroon_5_memories", "hot_ac"}, args) "maroon_5_memories", "hot_ac"}, args)
return suite.mockCmd return suite.mockCmd
@@ -191,14 +193,15 @@ func (suite *UpgradeTestSuite) TestRequiresChartAndRelease() {
func (suite *UpgradeTestSuite) TestPrepareDebugFlag() { func (suite *UpgradeTestSuite) TestPrepareDebugFlag() {
stdout := strings.Builder{} stdout := strings.Builder{}
stderr := strings.Builder{} stderr := strings.Builder{}
cfg := env.Config{
Chart: "at40", cfg := env.NewTestConfig(suite.T())
Release: "lewis_capaldi_someone_you_loved", cfg.Chart = "at40"
Debug: true, cfg.Release = "lewis_capaldi_someone_you_loved"
Stdout: &stdout, cfg.Debug = true
Stderr: &stderr, cfg.Stdout = &stdout
} cfg.Stderr = &stderr
u := NewUpgrade(cfg)
u := NewUpgrade(*cfg)
command = func(path string, args ...string) cmd { command = func(path string, args ...string) cmd {
suite.mockCmd.EXPECT(). suite.mockCmd.EXPECT().
@@ -215,8 +218,34 @@ func (suite *UpgradeTestSuite) TestPrepareDebugFlag() {
u.Prepare() u.Prepare()
want := fmt.Sprintf("Generated command: '%s --debug upgrade "+ want := fmt.Sprintf(
"--install lewis_capaldi_someone_you_loved at40'\n", helmBin) "Generated command: '%s --debug upgrade --install --history-max=10 lewis_capaldi_someone_you_loved at40'\n",
helmBin,
)
suite.Equal(want, stderr.String()) suite.Equal(want, stderr.String())
suite.Equal("", stdout.String()) suite.Equal("", stdout.String())
} }
func (suite *UpgradeTestSuite) TestPrepareSkipCrdsFlag() {
defer suite.ctrl.Finish()
cfg := env.NewTestConfig(suite.T())
cfg.Chart = "at40"
cfg.Release = "cabbages_smell_great"
cfg.SkipCrds = true
u := NewUpgrade(*cfg)
command = func(path string, args ...string) cmd {
suite.Equal(helmBin, path)
suite.Equal([]string{"upgrade", "--install", "--skip-crds", "--history-max=10", "cabbages_smell_great", "at40"}, args)
return suite.mockCmd
}
suite.mockCmd.EXPECT().Stdout(gomock.Any())
suite.mockCmd.EXPECT().Stderr(gomock.Any())
err := u.Prepare()
suite.Require().Nil(err)
}