Compare commits
61 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a9cf23ab9 | ||
|
|
3d1a2227da | ||
|
|
a826f66425 | ||
|
|
71421fbaa5 | ||
|
|
cfd8e33995 | ||
|
|
a5342d7bac | ||
|
|
6aa1d79d56 | ||
|
|
1d1117ba49 | ||
|
|
04de280821 | ||
|
|
7cfe20db1f | ||
|
|
7fc8212451 | ||
|
|
7cb7ecec90 | ||
|
|
55017eed0f | ||
|
|
b6ba856c31 | ||
|
|
8c6c6fbfa5 | ||
|
|
e071d23fef | ||
|
|
c8b4ad4c46 | ||
|
|
971e3f17cb | ||
|
|
ee3dc9ff0e | ||
|
|
7ecfe70e3e | ||
|
|
d5bd083bf5 | ||
|
|
8d8bcf78a7 | ||
|
|
222261d931 | ||
|
|
e694d93445 | ||
|
|
eaac6dd643 | ||
|
|
c569059b87 | ||
|
|
45428a2e25 | ||
|
|
7b816ea257 | ||
|
|
3c44be059e | ||
|
|
11ffdc7210 | ||
|
|
b4a13d9971 | ||
|
|
4330728215 | ||
|
|
3ae13d4b3c | ||
|
|
17724e7015 | ||
|
|
04a2c48ece | ||
|
|
997a33fc0d | ||
|
|
280c8577a4 | ||
|
|
51058470e5 | ||
|
|
7d750f097d | ||
|
|
9c91a415b0 | ||
|
|
9e8de53f8f | ||
|
|
2893e09651 | ||
|
|
69a15a8d48 | ||
|
|
27827a2940 | ||
|
|
eb2d280d59 | ||
|
|
3bf73acb42 | ||
|
|
997f49bb8d | ||
|
|
86984bcecd | ||
|
|
c4329833f8 | ||
|
|
3fa2d71559 | ||
|
|
f919966cf0 | ||
|
|
fed4de2ed9 | ||
|
|
e641102770 | ||
|
|
51db551995 | ||
|
|
2389268fa2 | ||
|
|
fe7ee09350 | ||
|
|
680989754a | ||
|
|
7cd46bb8b1 | ||
|
|
ab7abb699a | ||
|
|
8e5a32ff85 | ||
|
|
12c8e08d6f |
11
.github/ISSUE_TEMPLATE/documentation.md
vendored
Normal file
11
.github/ISSUE_TEMPLATE/documentation.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
name: Documentation
|
||||||
|
about: Docs you'd like to see, or questions about existing docs
|
||||||
|
title: ''
|
||||||
|
labels: documentation
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**What needs explanation:**
|
||||||
|
<!-- e.g. "what happens when ____", "how do I ___", etc. -->
|
||||||
6
.github/pull_request_template.md
vendored
6
.github/pull_request_template.md
vendored
@@ -3,6 +3,8 @@
|
|||||||
Pre-merge checklist:
|
Pre-merge checklist:
|
||||||
|
|
||||||
* [ ] Code changes have tests
|
* [ ] Code changes have tests
|
||||||
* [ ] Any changes to the config are documented in `docs/parameter_reference.md`
|
* [ ] Any config changes are documented:
|
||||||
* [ ] Any new _required_ config is documented in `README.md`
|
* If the change touches _required_ config, there's a corresponding update to `README.md`
|
||||||
|
* There's a corresponding update to `docs/parameter_reference.md`
|
||||||
|
* There's a pull request to update [the parameter reference in drone-plugin-index](https://github.com/drone/drone-plugin-index/blob/master/content/pelotech/drone-helm3/index.md)
|
||||||
* [ ] Any large changes have been verified by running a Drone job
|
* [ ] Any large changes have been verified by running a Drone job
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,6 +5,8 @@
|
|||||||
*.so
|
*.so
|
||||||
*.dylib
|
*.dylib
|
||||||
|
|
||||||
|
.idea
|
||||||
|
|
||||||
# Test binary, built with `go test -c`
|
# Test binary, built with `go test -c`
|
||||||
*.test
|
*.test
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM alpine/helm
|
FROM alpine/helm:3.0.2
|
||||||
MAINTAINER Erin Call <erin@liffft.com>
|
MAINTAINER Erin Call <erin@liffft.com>
|
||||||
|
|
||||||
COPY build/drone-helm /bin/drone-helm
|
COPY build/drone-helm /bin/drone-helm
|
||||||
|
|||||||
46
README.md
46
README.md
@@ -1,12 +1,16 @@
|
|||||||
# Drone plugin for Helm 3
|
# Drone plugin for Helm 3
|
||||||
|
|
||||||
|
[](https://cloud.drone.io/pelotech/drone-helm3)
|
||||||
|
[](https://goreportcard.com/report/github.com/pelotech/drone-helm3)
|
||||||
|
[](https://microbadger.com/images/pelotech/drone-helm3 "Get your own image badge on microbadger.com")
|
||||||
|
|
||||||
This plugin provides an interface between [Drone](https://drone.io/) and [Helm 3](https://github.com/kubernetes/helm):
|
This plugin provides an interface between [Drone](https://drone.io/) and [Helm 3](https://github.com/kubernetes/helm):
|
||||||
|
|
||||||
* Lint your charts
|
* Lint your charts
|
||||||
* Deploy your service
|
* Deploy your service
|
||||||
* Delete your service
|
* Delete your service
|
||||||
|
|
||||||
The plugin is inpsired by [drone-helm](https://github.com/ipedrazas/drone-helm), which fills the same role for Helm 2. It provides a comparable feature-set and the configuration settings are backwards-compatible.
|
The plugin is inpsired by [drone-helm](https://github.com/ipedrazas/drone-helm), which fills the same role for Helm 2. It provides a comparable feature-set and the configuration settings are backward-compatible.
|
||||||
|
|
||||||
## Example configuration
|
## Example configuration
|
||||||
|
|
||||||
@@ -19,7 +23,7 @@ steps:
|
|||||||
- name: lint
|
- name: lint
|
||||||
image: pelotech/drone-helm3
|
image: pelotech/drone-helm3
|
||||||
settings:
|
settings:
|
||||||
helm_command: lint
|
mode: lint
|
||||||
chart: ./
|
chart: ./
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -30,12 +34,12 @@ steps:
|
|||||||
- name: deploy
|
- name: deploy
|
||||||
image: pelotech/drone-helm3
|
image: pelotech/drone-helm3
|
||||||
settings:
|
settings:
|
||||||
helm_command: upgrade
|
mode: upgrade
|
||||||
chart: ./
|
chart: ./
|
||||||
release: my-project
|
release: my-project
|
||||||
environment:
|
environment:
|
||||||
API_SERVER: https://my.kubernetes.installation/clusters/a-1234
|
KUBE_API_SERVER: https://my.kubernetes.installation/clusters/a-1234
|
||||||
KUBERNETES_TOKEN:
|
KUBE_TOKEN:
|
||||||
from_secret: kubernetes_token
|
from_secret: kubernetes_token
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -46,20 +50,23 @@ steps:
|
|||||||
- name: uninstall
|
- name: uninstall
|
||||||
image: pelotech/drone-helm3
|
image: pelotech/drone-helm3
|
||||||
settings:
|
settings:
|
||||||
helm_command: uninstall
|
mode: uninstall
|
||||||
release: my-project
|
release: my-project
|
||||||
environment:
|
environment:
|
||||||
API_SERVER: https://my.kubernetes.installation/clusters/a-1234
|
KUBE_API_SERVER: https://my.kubernetes.installation/clusters/a-1234
|
||||||
KUBERNETES_TOKEN:
|
KUBE_TOKEN:
|
||||||
from_secret: kubernetes_token
|
from_secret: kubernetes_token
|
||||||
```
|
```
|
||||||
|
|
||||||
## Upgrading from drone-helm
|
## Upgrading from drone-helm
|
||||||
|
|
||||||
drone-helm3 is largely backwards-compatible with drone-helm. There are some known differences:
|
drone-helm3 is largely backward-compatible with drone-helm. There are some known differences:
|
||||||
|
|
||||||
* `prefix` must be supplied via the `settings` block, not `environment`.
|
* You'll need to migrate the deployments in the cluster [helm-v2-to-helm-v3](https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/).
|
||||||
* Several settings no longer have any effect:
|
* EKS is not supported. See [#5](https://github.com/pelotech/drone-helm3/issues/5) for more information.
|
||||||
|
* The `prefix` setting is no longer supported. If you were relying on the `prefix` setting with `secrets: [...]`, you'll need to switch to the `from_secret` syntax.
|
||||||
|
* During uninstallations, the release history is purged by default. Use `keep_history: true` to return to the old behavior.
|
||||||
|
* Several settings no longer have any effect. The plugin will produce warnings if any of these are present:
|
||||||
* `purge` -- this is the default behavior in Helm 3
|
* `purge` -- this is the default behavior in Helm 3
|
||||||
* `recreate_pods`
|
* `recreate_pods`
|
||||||
* `tiller_ns`
|
* `tiller_ns`
|
||||||
@@ -67,5 +74,22 @@ drone-helm3 is largely backwards-compatible with drone-helm. There are some know
|
|||||||
* `canary_image`
|
* `canary_image`
|
||||||
* `client_only`
|
* `client_only`
|
||||||
* `stable_repo_url`
|
* `stable_repo_url`
|
||||||
|
* Several settings have been renamed, to clarify their purpose and provide a more consistent naming scheme. For backward-compatibility, the old names are still available as aliases. If the old and new names are both present, the updated form takes priority. Conflicting settings will make your `.drone.yml` harder to understand, so we recommend updating to the new names:
|
||||||
|
* `helm_command` is now `mode`
|
||||||
|
° `helm_repos` is now `add_repos`
|
||||||
|
* `api_server` is now `kube_api_server`
|
||||||
|
* `service_account` is now `kube_service_account`
|
||||||
|
* `kubernetes_token` is now `kube_token`
|
||||||
|
* `kubernetes_certificate` is now `kube_certificate`
|
||||||
|
* `wait` is now `wait_for_upgrade`
|
||||||
|
* `force` is now `force_upgrade`
|
||||||
|
|
||||||
Since helm 3 does not require Tiller, we also recommend switching to a service account with less-expansive permissions.
|
Since helm 3 does not require Tiller, we also recommend switching to a service account with less-expansive permissions.
|
||||||
|
|
||||||
|
### [Contributing](docs/contributing.md)
|
||||||
|
|
||||||
|
This repo is setup in a way that if you enable a personal drone server to build your fork it will
|
||||||
|
build and publish your image (makes it easier to test PRs and use the image till the contributions get merged)
|
||||||
|
|
||||||
|
* Build local ```DRONE_REPO_OWNER=josmo DRONE_REPO_NAME=drone-ecs drone exec```
|
||||||
|
* on your server (or cloud.drone.io) just make sure you have DOCKER_USERNAME, DOCKER_PASSWORD, and PLUGIN_REPO set as secrets
|
||||||
|
|||||||
@@ -24,16 +24,4 @@ users:
|
|||||||
user:
|
user:
|
||||||
{{- if .Token }}
|
{{- if .Token }}
|
||||||
token: {{ .Token }}
|
token: {{ .Token }}
|
||||||
{{- else if .EKSCluster }}
|
|
||||||
exec:
|
|
||||||
apiVersion: client.authentication.k8s.io/v1alpha1
|
|
||||||
command: aws-iam-authenticator
|
|
||||||
args:
|
|
||||||
- "token"
|
|
||||||
- "-i"
|
|
||||||
- "{{ .EKSCluster }}"
|
|
||||||
{{- if .EKSRoleARN }}
|
|
||||||
- "-r"
|
|
||||||
- "{{ .EKSRoleARN }}"
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
_ "github.com/joho/godotenv/autoload"
|
||||||
"github.com/pelotech/drone-helm3/internal/helm"
|
"github.com/pelotech/drone-helm3/internal/helm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
# Parameter reference
|
# Parameter reference
|
||||||
|
|
||||||
## Global
|
## Global
|
||||||
| Param name | Type | Purpose |
|
| Param name | Type | Alias | Purpose |
|
||||||
|---------------------|-----------------|---------|
|
|---------------------|-----------------|--------------|---------|
|
||||||
| helm_command | string | Indicates the operation to perform. Recommended, but not required. Valid options are `upgrade`, `uninstall`, `lint`, and `help`. |
|
| mode | string | helm_command | Indicates the operation to perform. Recommended, but not required. Valid options are `upgrade`, `uninstall`, `lint`, and `help`. |
|
||||||
| update_dependencies | boolean | Calls `helm dependency update` before running the main command.|
|
| update_dependencies | boolean | | Calls `helm dependency update` before running the main command.|
|
||||||
| helm_repos | list\<string\> | Calls `helm repo add $repo` before running the main command. Each string should be formatted as `repo_name=https://repo.url/`. |
|
| add_repos | list\<string\> | helm_repos | Calls `helm repo add $repo` before running the main command. Each string should be formatted as `repo_name=https://repo.url/`. |
|
||||||
| namespace | string | Kubernetes namespace to use for this operation. |
|
| namespace | string | | Kubernetes namespace to use for this operation. |
|
||||||
| prefix | string | Expect environment variables to be prefixed with the given string. For more details, see "Using the prefix setting" below. |
|
| debug | boolean | | Generate debug output within drone-helm3 and pass `--debug` to all helm commands. Use with care, since the debug output may include secrets. |
|
||||||
| debug | boolean | Generate debug output within drone-helm3 and pass `--debug` to all helm commands. Use with care, since the debug output may include secrets. |
|
|
||||||
|
|
||||||
## Linting
|
## Linting
|
||||||
|
|
||||||
Linting is only triggered when the `helm_command` setting is "lint".
|
Linting is only triggered when the `mode` setting is "lint".
|
||||||
|
|
||||||
| Param name | Type | Required | Purpose |
|
| Param name | Type | Required | Purpose |
|
||||||
|---------------|----------------|----------|---------|
|
|---------------|----------------|----------|---------|
|
||||||
@@ -20,49 +19,55 @@ Linting is only triggered when the `helm_command` setting is "lint".
|
|||||||
| values | list\<string\> | | Chart values to use as the `--set` argument to `helm lint`. |
|
| values | list\<string\> | | Chart values to use as the `--set` argument to `helm lint`. |
|
||||||
| string_values | list\<string\> | | Chart values to use as the `--set-string` argument to `helm lint`. |
|
| string_values | list\<string\> | | Chart values to use as the `--set-string` argument to `helm lint`. |
|
||||||
| values_files | list\<string\> | | Values to use as `--values` arguments to `helm lint`. |
|
| values_files | list\<string\> | | Values to use as `--values` arguments to `helm lint`. |
|
||||||
|
| lint_strictly | boolean | | Pass `--strict` to `helm lint`, to turn warnings into errors. |
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Installations are triggered when the `helm_command` setting is "upgrade." They can also be triggered when the build was triggered by a `push`, `tag`, `deployment`, `pull_request`, `promote`, or `rollback` Drone event.
|
Installations are triggered when the `mode` setting is "upgrade." They can also be triggered when the build was triggered by a `push`, `tag`, `deployment`, `pull_request`, `promote`, or `rollback` Drone event.
|
||||||
|
|
||||||
| Param name | Type | Required | Purpose |
|
| Param name | Type | Required | Alias | Purpose |
|
||||||
|------------------------|----------------|----------|---------|
|
|------------------------|----------------|----------|------------------------|---------|
|
||||||
| chart | string | yes | The chart to use for this installation. |
|
| chart | string | yes | | The chart to use for this installation. |
|
||||||
| release | string | yes | The release name for helm to use. |
|
| release | string | yes | | The release name for helm to use. |
|
||||||
| api_server | string | yes | API endpoint for the Kubernetes cluster. |
|
| kube_api_server | string | yes | api_server | API endpoint for the Kubernetes cluster. |
|
||||||
| kubernetes_token | string | yes | Token for authenticating to Kubernetes. |
|
| kube_token | string | yes | kubernetes_token | Token for authenticating to Kubernetes. |
|
||||||
| service_account | string | | Service account for authenticating to Kubernetes. Default is `helm`. |
|
| kube_service_account | string | | service_account | Service account for authenticating to Kubernetes. Default is `helm`. |
|
||||||
| kubernetes_certificate | string | | Base64 encoded TLS certificate used by the Kubernetes cluster's certificate authority. |
|
| kube_certificate | string | | kubernetes_certificate | Base64 encoded TLS certificate used by the Kubernetes cluster's certificate authority. |
|
||||||
| chart_version | string | | Specific chart version to install. |
|
| chart_version | string | | | Specific chart version to install. |
|
||||||
| dry_run | boolean | | Pass `--dry-run` to `helm upgrade`. |
|
| dry_run | boolean | | | Pass `--dry-run` to `helm upgrade`. |
|
||||||
| wait | boolean | | Wait until kubernetes resources are in a ready state before marking the installation successful. |
|
| wait_for_upgrade | boolean | | wait | Wait until kubernetes resources are in a ready state before marking the installation successful. |
|
||||||
| timeout | duration | | Timeout for any *individual* Kubernetes operation. The installation's full runtime may exceed this duration. |
|
| timeout | duration | | | Timeout for any *individual* Kubernetes operation. The installation's full runtime may exceed this duration. |
|
||||||
| force | boolean | | Pass `--force` to `helm upgrade`. |
|
| force_upgrade | boolean | | force | Pass `--force` to `helm upgrade`. |
|
||||||
| values | list\<string\> | | Chart values to use as the `--set` argument to `helm upgrade`. |
|
| atomic_upgrade | boolean | | | Pass `--atomic` to `helm upgrade`. |
|
||||||
| string_values | list\<string\> | | Chart values to use as the `--set-string` argument to `helm upgrade`. |
|
| cleanup_failed_upgrade | boolean | | | Pass `--cleanup-on-fail` to `helm upgrade`. |
|
||||||
| values_files | list\<string\> | | Values to use as `--values` arguments to `helm upgrade`. |
|
| values | list\<string\> | | | Chart values to use as the `--set` argument to `helm upgrade`. |
|
||||||
| reuse_values | boolean | | Reuse the values from a previous release. |
|
| string_values | list\<string\> | | | Chart values to use as the `--set-string` argument to `helm upgrade`. |
|
||||||
| skip_tls_verify | boolean | | Connect to the Kubernetes cluster without checking for a valid TLS certificate. Not recommended in production. |
|
| values_files | list\<string\> | | | Values to use as `--values` arguments to `helm upgrade`. |
|
||||||
|
| 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. |
|
||||||
|
|
||||||
## Uninstallation
|
## Uninstallation
|
||||||
|
|
||||||
Uninstallations are triggered when the `helm_command` setting is "uninstall" or "delete." They can also be triggered when the build was triggered by a `delete` Drone event.
|
Uninstallations are triggered when the `mode` setting is "uninstall" or "delete." They can also be triggered when the build was triggered by a `delete` Drone event.
|
||||||
|
|
||||||
| Param name | Type | Required | Purpose |
|
| Param name | Type | Required | Alias | Purpose |
|
||||||
|------------------------|----------|----------|---------|
|
|------------------------|----------|----------|------------------------|---------|
|
||||||
| release | string | yes | The release name for helm to use. |
|
| release | string | yes | | The release name for helm to use. |
|
||||||
| api_server | string | yes | API endpoint for the Kubernetes cluster. |
|
| kube_api_server | string | yes | api_server | API endpoint for the Kubernetes cluster. |
|
||||||
| kubernetes_token | string | yes | Token for authenticating to Kubernetes. |
|
| kube_token | string | yes | kubernetes_token | Token for authenticating to Kubernetes. |
|
||||||
| service_account | string | | Service account for authenticating to Kubernetes. Default is `helm`. |
|
| kube_service_account | string | | service_account | Service account for authenticating to Kubernetes. Default is `helm`. |
|
||||||
| kubernetes_certificate | string | | Base64 encoded TLS certificate used by the Kubernetes cluster's certificate authority. |
|
| kube_certificate | string | | kubernetes_certificate | Base64 encoded TLS certificate used by the Kubernetes cluster's certificate authority. |
|
||||||
| dry_run | boolean | | Pass `--dry-run` to `helm uninstall`. |
|
| keep_history | boolean | | | Pass `--keep-history` to `helm uninstall`, to retain the release history. |
|
||||||
| timeout | duration | | Timeout for any *individual* Kubernetes operation. The uninstallation's full runtime may exceed this duration. |
|
| dry_run | boolean | | | Pass `--dry-run` to `helm uninstall`. |
|
||||||
| skip_tls_verify | boolean | | Connect to the Kubernetes cluster without checking for a valid TLS certificate. Not recommended in production. |
|
| timeout | duration | | | Timeout for any *individual* Kubernetes operation. The uninstallation's full runtime may exceed this duration. |
|
||||||
| chart | string | | Required when the global `update_dependencies` parameter is true. No effect otherwise. |
|
| skip_tls_verify | boolean | | | Connect to the Kubernetes cluster without checking for a valid TLS certificate. Not recommended in production. |
|
||||||
|
| chart | string | | | Required when the global `update_dependencies` parameter is true. No effect otherwise. |
|
||||||
|
|
||||||
### Where to put settings
|
### Where to put settings
|
||||||
|
|
||||||
Any setting (with the exception of `prefix`; [see below](#user-content-using-the-prefix-setting)), can go in either the `settings` or `environment` section.
|
Any setting can go in either the `settings` or `environment` section. If a setting exists in _both_ sections, the version in `environment` will override the version in `settings`.
|
||||||
|
|
||||||
|
We recommend putting all drone-helm3 configuration in the `settings` block and limiting the `environment` block to variables that are used when building your charts.
|
||||||
|
|
||||||
### Formatting non-string values
|
### Formatting non-string values
|
||||||
|
|
||||||
@@ -88,44 +93,17 @@ values_files: [ "./over_9,000.yml" ]
|
|||||||
values_files: [ "./over_9", "000.yml" ]
|
values_files: [ "./over_9", "000.yml" ]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using the `prefix` setting
|
### Backward-compatibility aliases
|
||||||
|
|
||||||
Because the prefix setting is meta-configuration, it has some inherent edge-cases. Here is what it does in the cases we've thought of:
|
Some settings have alternate names, for backward-compatibility with drone-helm. We recommend using the canonical name unless you require the backward-compatible form.
|
||||||
|
|
||||||
Unlike the other settings, it must be declared in the `settings` block, not `environment`:
|
| Canonical name | Alias |
|
||||||
|
|----------------------|-------|
|
||||||
```yaml
|
| mode | helm_command |
|
||||||
settings:
|
| add_repos | helm_repos |
|
||||||
prefix: helm # drone-helm3 will look for environment variables called HELM_VARNAME
|
| kube_api_server | api_server |
|
||||||
environment:
|
| kube_service_account | service_account |
|
||||||
prefix: armet # no effect
|
| kube_token | kubernetes_token |
|
||||||
```
|
| kube_certificate | kubernetes_certificate |
|
||||||
|
| wait_for_upgrade | wait |
|
||||||
It does not apply to configuration in the `settings` block, only in `environment`:
|
| force_upgrade | force |
|
||||||
|
|
||||||
```yaml
|
|
||||||
settings:
|
|
||||||
prefix: helm
|
|
||||||
helm_timeout: 5m # no effect
|
|
||||||
environment:
|
|
||||||
helm_timeout: 2m # timeout will be 2 minutes
|
|
||||||
```
|
|
||||||
|
|
||||||
If the environment contains a variable in non-prefixed form, it will still be applied:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
settings:
|
|
||||||
prefix: helm
|
|
||||||
environment:
|
|
||||||
timeout: 2m # timeout will be 2 minutes
|
|
||||||
```
|
|
||||||
|
|
||||||
If the environment contains both the prefixed and non-prefixed forms, drone-helm3 will use the prefixed form:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
settings:
|
|
||||||
prefix: helm
|
|
||||||
environment:
|
|
||||||
timeout: 5m # overridden
|
|
||||||
helm_timeout: 2m # timeout will be 2 minutes
|
|
||||||
```
|
|
||||||
|
|||||||
1
go.mod
1
go.mod
@@ -4,6 +4,7 @@ go 1.13
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/golang/mock v1.3.1
|
github.com/golang/mock v1.3.1
|
||||||
|
github.com/joho/godotenv v1.3.0
|
||||||
github.com/kelseyhightower/envconfig v1.4.0
|
github.com/kelseyhightower/envconfig v1.4.0
|
||||||
github.com/stretchr/testify v1.4.0
|
github.com/stretchr/testify v1.4.0
|
||||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect
|
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect
|
||||||
|
|||||||
2
go.sum
2
go.sum
@@ -2,6 +2,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
|
|||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s=
|
github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s=
|
||||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||||
|
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||||
|
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
|
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
|
||||||
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
|
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
|||||||
@@ -4,40 +4,48 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/kelseyhightower/envconfig"
|
"github.com/kelseyhightower/envconfig"
|
||||||
"io"
|
"io"
|
||||||
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var justNumbers = regexp.MustCompile(`^\d+$`)
|
var (
|
||||||
|
justNumbers = regexp.MustCompile(`^\d+$`)
|
||||||
|
deprecatedVars = []string{"PURGE", "RECREATE_PODS", "TILLER_NS", "UPGRADE", "CANARY_IMAGE", "CLIENT_ONLY", "STABLE_REPO_URL"}
|
||||||
|
)
|
||||||
|
|
||||||
// The Config struct captures the `settings` and `environment` blocks in the application's drone
|
// The Config struct captures the `settings` and `environment` blocks in the application's drone
|
||||||
// config. Configuration in drone's `settings` block arrives as uppercase env vars matching the
|
// config. Configuration in drone's `settings` block arrives as uppercase env vars matching the
|
||||||
// config key, prefixed with `PLUGIN_`. Config from the `environment` block is uppercased, but does
|
// config key, prefixed with `PLUGIN_`. Config from the `environment` block is uppercased, but does
|
||||||
// not have the `PLUGIN_` prefix. It may, however, be prefixed with the value in `$PLUGIN_PREFIX`.
|
// not have the `PLUGIN_` prefix.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
// Configuration for drone-helm itself
|
// Configuration for drone-helm itself
|
||||||
Command string `envconfig:"HELM_COMMAND"` // Helm command to run
|
Command string `envconfig:"mode"` // Helm command to run
|
||||||
DroneEvent string `envconfig:"DRONE_BUILD_EVENT"` // Drone event that invoked this plugin.
|
DroneEvent string `envconfig:"DRONE_BUILD_EVENT"` // Drone event that invoked this plugin.
|
||||||
UpdateDependencies bool `split_words:"true"` // Call `helm dependency update` before the main command
|
UpdateDependencies bool `split_words:"true"` // Call `helm dependency update` before the main command
|
||||||
AddRepos []string `envconfig:"HELM_REPOS"` // Call `helm repo add` before the main command
|
AddRepos []string `split_words:"true"` // Call `helm repo add` before the main command
|
||||||
Prefix string `` // Prefix to use when looking up secret env vars
|
|
||||||
Debug bool `` // Generate debug output and pass --debug to all helm commands
|
Debug bool `` // Generate debug output and pass --debug to all helm commands
|
||||||
Values string `` // Argument to pass to --set in applicable helm commands
|
Values string `` // Argument to pass to --set in applicable helm commands
|
||||||
StringValues string `split_words:"true"` // Argument to pass to --set-string in applicable helm commands
|
StringValues string `split_words:"true"` // Argument to pass to --set-string in applicable helm commands
|
||||||
ValuesFiles []string `split_words:"true"` // Arguments to pass to --values in applicable helm commands
|
ValuesFiles []string `split_words:"true"` // Arguments to pass to --values in applicable helm commands
|
||||||
Namespace string `` // Kubernetes namespace for all helm commands
|
Namespace string `` // Kubernetes namespace for all helm commands
|
||||||
KubeToken string `envconfig:"KUBERNETES_TOKEN"` // Kubernetes authentication token to put in .kube/config
|
KubeToken string `split_words:"true"` // Kubernetes authentication token to put in .kube/config
|
||||||
SkipTLSVerify bool `envconfig:"SKIP_TLS_VERIFY"` // Put insecure-skip-tls-verify in .kube/config
|
SkipTLSVerify bool `envconfig:"SKIP_TLS_VERIFY"` // Put insecure-skip-tls-verify in .kube/config
|
||||||
Certificate string `envconfig:"KUBERNETES_CERTIFICATE"` // The Kubernetes cluster CA's self-signed certificate (must be base64-encoded)
|
Certificate string `envconfig:"kube_certificate"` // The Kubernetes cluster CA's self-signed certificate (must be base64-encoded)
|
||||||
APIServer string `envconfig:"API_SERVER"` // The Kubernetes cluster's API endpoint
|
APIServer string `envconfig:"kube_api_server"` // The Kubernetes cluster's API endpoint
|
||||||
ServiceAccount string `split_words:"true"` // Account to use for connecting to the Kubernetes cluster
|
ServiceAccount string `envconfig:"kube_service_account"` // Account to use for connecting to the Kubernetes cluster
|
||||||
ChartVersion string `split_words:"true"` // Specific chart version to use in `helm upgrade`
|
ChartVersion string `split_words:"true"` // Specific chart version to use in `helm upgrade`
|
||||||
DryRun bool `split_words:"true"` // Pass --dry-run to applicable helm commands
|
DryRun bool `split_words:"true"` // Pass --dry-run to applicable helm commands
|
||||||
Wait bool `` // 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`
|
||||||
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
|
||||||
Force bool `` // Pass --force to applicable helm commands
|
Force bool `envconfig:"force_upgrade"` // Pass --force to applicable helm commands
|
||||||
|
AtomicUpgrade bool `split_words:"true"` // Pass --atomic 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`
|
||||||
|
|
||||||
Stdout io.Writer `ignored:"true"`
|
Stdout io.Writer `ignored:"true"`
|
||||||
Stderr io.Writer `ignored:"true"`
|
Stderr io.Writer `ignored:"true"`
|
||||||
@@ -45,7 +53,25 @@ type Config struct {
|
|||||||
|
|
||||||
// NewConfig creates a Config and reads environment variables into it, accounting for several possible formats.
|
// NewConfig creates a Config and reads environment variables into it, accounting for several possible formats.
|
||||||
func NewConfig(stdout, stderr io.Writer) (*Config, error) {
|
func NewConfig(stdout, stderr io.Writer) (*Config, error) {
|
||||||
|
var aliases settingAliases
|
||||||
|
if err := envconfig.Process("plugin", &aliases); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := envconfig.Process("", &aliases); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
cfg := Config{
|
cfg := Config{
|
||||||
|
Command: aliases.Command,
|
||||||
|
AddRepos: aliases.AddRepos,
|
||||||
|
APIServer: aliases.APIServer,
|
||||||
|
ServiceAccount: aliases.ServiceAccount,
|
||||||
|
Wait: aliases.Wait,
|
||||||
|
Force: aliases.Force,
|
||||||
|
KubeToken: aliases.KubeToken,
|
||||||
|
Certificate: aliases.Certificate,
|
||||||
|
|
||||||
Stdout: stdout,
|
Stdout: stdout,
|
||||||
Stderr: stderr,
|
Stderr: stderr,
|
||||||
}
|
}
|
||||||
@@ -53,18 +79,10 @@ func NewConfig(stdout, stderr io.Writer) (*Config, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix := cfg.Prefix
|
|
||||||
|
|
||||||
if err := envconfig.Process("", &cfg); err != nil {
|
if err := envconfig.Process("", &cfg); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if prefix != "" {
|
|
||||||
if err := envconfig.Process(cfg.Prefix, &cfg); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if justNumbers.MatchString(cfg.Timeout) {
|
if justNumbers.MatchString(cfg.Timeout) {
|
||||||
cfg.Timeout = fmt.Sprintf("%ss", cfg.Timeout)
|
cfg.Timeout = fmt.Sprintf("%ss", cfg.Timeout)
|
||||||
}
|
}
|
||||||
@@ -73,6 +91,8 @@ func NewConfig(stdout, stderr io.Writer) (*Config, error) {
|
|||||||
cfg.logDebug()
|
cfg.logDebug()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg.deprecationWarn()
|
||||||
|
|
||||||
return &cfg, nil
|
return &cfg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,3 +102,24 @@ func (cfg Config) logDebug() {
|
|||||||
}
|
}
|
||||||
fmt.Fprintf(cfg.Stderr, "Generated config: %+v\n", cfg)
|
fmt.Fprintf(cfg.Stderr, "Generated config: %+v\n", cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (cfg *Config) deprecationWarn() {
|
||||||
|
for _, varname := range deprecatedVars {
|
||||||
|
_, barePresent := os.LookupEnv(varname)
|
||||||
|
_, prefixedPresent := os.LookupEnv("PLUGIN_" + varname)
|
||||||
|
if barePresent || prefixedPresent {
|
||||||
|
fmt.Fprintf(cfg.Stderr, "Warning: ignoring deprecated '%s' setting\n", strings.ToLower(varname))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type settingAliases struct {
|
||||||
|
Command string `envconfig:"helm_command"`
|
||||||
|
AddRepos []string `envconfig:"helm_repos"`
|
||||||
|
APIServer string `envconfig:"api_server"`
|
||||||
|
ServiceAccount string `split_words:"true"`
|
||||||
|
Wait bool ``
|
||||||
|
Force bool ``
|
||||||
|
KubeToken string `envconfig:"kubernetes_token"`
|
||||||
|
Certificate string `envconfig:"kubernetes_certificate"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package helm
|
package helm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -19,91 +20,47 @@ func TestConfigTestSuite(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ConfigTestSuite) TestNewConfigWithPluginPrefix() {
|
func (suite *ConfigTestSuite) TestNewConfigWithPluginPrefix() {
|
||||||
suite.unsetenv("PLUGIN_PREFIX")
|
suite.unsetenv("MODE")
|
||||||
suite.unsetenv("HELM_COMMAND")
|
|
||||||
suite.unsetenv("UPDATE_DEPENDENCIES")
|
suite.unsetenv("UPDATE_DEPENDENCIES")
|
||||||
suite.unsetenv("DEBUG")
|
suite.unsetenv("DEBUG")
|
||||||
|
|
||||||
suite.setenv("PLUGIN_HELM_COMMAND", "execute order 66")
|
suite.setenv("PLUGIN_MODE", "iambic")
|
||||||
suite.setenv("PLUGIN_UPDATE_DEPENDENCIES", "true")
|
suite.setenv("PLUGIN_UPDATE_DEPENDENCIES", "true")
|
||||||
suite.setenv("PLUGIN_DEBUG", "true")
|
suite.setenv("PLUGIN_DEBUG", "true")
|
||||||
|
|
||||||
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
suite.Equal("execute order 66", cfg.Command)
|
suite.Equal("iambic", cfg.Command)
|
||||||
suite.True(cfg.UpdateDependencies)
|
suite.True(cfg.UpdateDependencies)
|
||||||
suite.True(cfg.Debug)
|
suite.True(cfg.Debug)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ConfigTestSuite) TestNewConfigWithNoPrefix() {
|
func (suite *ConfigTestSuite) TestNewConfigWithNoPrefix() {
|
||||||
suite.unsetenv("PLUGIN_PREFIX")
|
suite.unsetenv("PLUGIN_MODE")
|
||||||
suite.unsetenv("PLUGIN_HELM_COMMAND")
|
|
||||||
suite.unsetenv("PLUGIN_UPDATE_DEPENDENCIES")
|
suite.unsetenv("PLUGIN_UPDATE_DEPENDENCIES")
|
||||||
suite.unsetenv("PLUGIN_DEBUG")
|
suite.unsetenv("PLUGIN_DEBUG")
|
||||||
|
|
||||||
suite.setenv("HELM_COMMAND", "execute order 66")
|
suite.setenv("MODE", "iambic")
|
||||||
suite.setenv("UPDATE_DEPENDENCIES", "true")
|
suite.setenv("UPDATE_DEPENDENCIES", "true")
|
||||||
suite.setenv("DEBUG", "true")
|
suite.setenv("DEBUG", "true")
|
||||||
|
|
||||||
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
suite.Equal("execute order 66", cfg.Command)
|
suite.Equal("iambic", cfg.Command)
|
||||||
suite.True(cfg.UpdateDependencies)
|
suite.True(cfg.UpdateDependencies)
|
||||||
suite.True(cfg.Debug)
|
suite.True(cfg.Debug)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ConfigTestSuite) TestNewConfigWithConfigurablePrefix() {
|
|
||||||
suite.unsetenv("API_SERVER")
|
|
||||||
suite.unsetenv("PLUGIN_API_SERVER")
|
|
||||||
|
|
||||||
suite.setenv("PLUGIN_PREFIX", "prix_fixe")
|
|
||||||
suite.setenv("PRIX_FIXE_API_SERVER", "your waiter this evening")
|
|
||||||
|
|
||||||
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
|
||||||
suite.Require().NoError(err)
|
|
||||||
|
|
||||||
suite.Equal("prix_fixe", cfg.Prefix)
|
|
||||||
suite.Equal("your waiter this evening", cfg.APIServer)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (suite *ConfigTestSuite) TestPrefixSettingDoesNotAffectPluginPrefix() {
|
|
||||||
suite.setenv("PLUGIN_PREFIX", "IXFREP")
|
|
||||||
suite.setenv("PLUGIN_HELM_COMMAND", "wake me up")
|
|
||||||
suite.setenv("IXFREP_PLUGIN_HELM_COMMAND", "send me to sleep inside")
|
|
||||||
|
|
||||||
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
|
||||||
suite.Require().NoError(err)
|
|
||||||
|
|
||||||
suite.Equal("wake me up", cfg.Command)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (suite *ConfigTestSuite) TestPrefixSettingMustHavePluginPrefix() {
|
|
||||||
suite.unsetenv("PLUGIN_PREFIX")
|
|
||||||
suite.setenv("PREFIX", "refpix")
|
|
||||||
suite.setenv("HELM_COMMAND", "gimme more")
|
|
||||||
suite.setenv("REFPIX_HELM_COMMAND", "gimme less")
|
|
||||||
|
|
||||||
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
|
||||||
suite.Require().NoError(err)
|
|
||||||
|
|
||||||
suite.Equal("gimme more", cfg.Command)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (suite *ConfigTestSuite) TestNewConfigWithConflictingVariables() {
|
func (suite *ConfigTestSuite) TestNewConfigWithConflictingVariables() {
|
||||||
suite.setenv("PLUGIN_HELM_COMMAND", "execute order 66")
|
suite.setenv("PLUGIN_MODE", "iambic")
|
||||||
suite.setenv("HELM_COMMAND", "defend the jedi") // values from the `environment` block override those from `settings`
|
suite.setenv("MODE", "haiku") // values from the `environment` block override those from `settings`
|
||||||
|
|
||||||
suite.setenv("PLUGIN_PREFIX", "prod")
|
|
||||||
suite.setenv("TIMEOUT", "5m0s")
|
|
||||||
suite.setenv("PROD_TIMEOUT", "2m30s") // values from prefixed env vars override those from non-prefixed ones
|
|
||||||
|
|
||||||
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
suite.Equal("defend the jedi", cfg.Command)
|
suite.Equal("haiku", cfg.Command)
|
||||||
suite.Equal("2m30s", cfg.Timeout)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ConfigTestSuite) TestNewConfigInfersNumbersAreSeconds() {
|
func (suite *ConfigTestSuite) TestNewConfigInfersNumbersAreSeconds() {
|
||||||
@@ -113,6 +70,62 @@ func (suite *ConfigTestSuite) TestNewConfigInfersNumbersAreSeconds() {
|
|||||||
suite.Equal("42s", cfg.Timeout)
|
suite.Equal("42s", cfg.Timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *ConfigTestSuite) TestNewConfigWithAliases() {
|
||||||
|
for _, varname := range []string{
|
||||||
|
"MODE",
|
||||||
|
"ADD_REPOS",
|
||||||
|
"KUBE_API_SERVER",
|
||||||
|
"KUBE_SERVICE_ACCOUNT",
|
||||||
|
"WAIT_FOR_UPGRADE",
|
||||||
|
"FORCE_UPGRADE",
|
||||||
|
"KUBE_TOKEN",
|
||||||
|
"KUBE_CERTIFICATE",
|
||||||
|
} {
|
||||||
|
suite.unsetenv(varname)
|
||||||
|
suite.unsetenv("PLUGIN_" + varname)
|
||||||
|
}
|
||||||
|
suite.setenv("PLUGIN_HELM_COMMAND", "beware the jabberwock")
|
||||||
|
suite.setenv("PLUGIN_HELM_REPOS", "chortle=http://calloo.callay/frabjous/day")
|
||||||
|
suite.setenv("PLUGIN_API_SERVER", "http://tumtum.tree")
|
||||||
|
suite.setenv("PLUGIN_SERVICE_ACCOUNT", "tulgey")
|
||||||
|
suite.setenv("PLUGIN_WAIT", "true")
|
||||||
|
suite.setenv("PLUGIN_FORCE", "true")
|
||||||
|
suite.setenv("PLUGIN_KUBERNETES_TOKEN", "Y29tZSB0byBteSBhcm1z")
|
||||||
|
suite.setenv("PLUGIN_KUBERNETES_CERTIFICATE", "d2l0aCBpdHMgaGVhZA==")
|
||||||
|
|
||||||
|
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
||||||
|
suite.Require().NoError(err)
|
||||||
|
suite.Equal("beware the jabberwock", cfg.Command)
|
||||||
|
suite.Equal([]string{"chortle=http://calloo.callay/frabjous/day"}, cfg.AddRepos)
|
||||||
|
suite.Equal("http://tumtum.tree", cfg.APIServer)
|
||||||
|
suite.Equal("tulgey", cfg.ServiceAccount)
|
||||||
|
suite.True(cfg.Wait, "Wait should be aliased")
|
||||||
|
suite.True(cfg.Force, "Force should be aliased")
|
||||||
|
suite.Equal("Y29tZSB0byBteSBhcm1z", cfg.KubeToken, "KubeToken should be aliased")
|
||||||
|
suite.Equal("d2l0aCBpdHMgaGVhZA==", cfg.Certificate, "Certificate should be aliased")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *ConfigTestSuite) TestAliasedSettingWithoutPluginPrefix() {
|
||||||
|
suite.unsetenv("FORCE_UPGRADE")
|
||||||
|
suite.unsetenv("PLUGIN_FORCE_UPGRADE")
|
||||||
|
suite.unsetenv("PLUGIN_FORCE")
|
||||||
|
suite.setenv("FORCE", "true")
|
||||||
|
|
||||||
|
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
||||||
|
suite.Require().NoError(err)
|
||||||
|
suite.True(cfg.Force)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *ConfigTestSuite) TestNewConfigWithAliasConflicts() {
|
||||||
|
suite.unsetenv("FORCE_UPGRADE")
|
||||||
|
suite.setenv("PLUGIN_FORCE", "true")
|
||||||
|
suite.setenv("PLUGIN_FORCE_UPGRADE", "false") // should override even when set to the zero value
|
||||||
|
|
||||||
|
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
||||||
|
suite.NoError(err)
|
||||||
|
suite.False(cfg.Force, "official names should override alias names")
|
||||||
|
}
|
||||||
|
|
||||||
func (suite *ConfigTestSuite) TestNewConfigSetsWriters() {
|
func (suite *ConfigTestSuite) TestNewConfigSetsWriters() {
|
||||||
stdout := &strings.Builder{}
|
stdout := &strings.Builder{}
|
||||||
stderr := &strings.Builder{}
|
stderr := &strings.Builder{}
|
||||||
@@ -123,9 +136,27 @@ func (suite *ConfigTestSuite) TestNewConfigSetsWriters() {
|
|||||||
suite.Equal(stderr, cfg.Stderr)
|
suite.Equal(stderr, cfg.Stderr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *ConfigTestSuite) TestDeprecatedSettingWarnings() {
|
||||||
|
for _, varname := range deprecatedVars {
|
||||||
|
suite.setenv(varname, "deprecoat") // environment-block entries should cause warnings
|
||||||
|
}
|
||||||
|
|
||||||
|
suite.unsetenv("PURGE")
|
||||||
|
suite.setenv("PLUGIN_PURGE", "true") // settings-block entries should cause warnings
|
||||||
|
suite.setenv("UPGRADE", "") // entries should cause warnings even when set to empty string
|
||||||
|
|
||||||
|
stderr := &strings.Builder{}
|
||||||
|
_, err := NewConfig(&strings.Builder{}, stderr)
|
||||||
|
suite.NoError(err)
|
||||||
|
|
||||||
|
for _, varname := range deprecatedVars {
|
||||||
|
suite.Contains(stderr.String(), fmt.Sprintf("Warning: ignoring deprecated '%s' setting\n", strings.ToLower(varname)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (suite *ConfigTestSuite) TestLogDebug() {
|
func (suite *ConfigTestSuite) TestLogDebug() {
|
||||||
suite.setenv("DEBUG", "true")
|
suite.setenv("DEBUG", "true")
|
||||||
suite.setenv("HELM_COMMAND", "upgrade")
|
suite.setenv("MODE", "upgrade")
|
||||||
|
|
||||||
stderr := strings.Builder{}
|
stderr := strings.Builder{}
|
||||||
stdout := strings.Builder{}
|
stdout := strings.Builder{}
|
||||||
|
|||||||
@@ -30,9 +30,6 @@ func NewPlan(cfg Config) (*Plan, error) {
|
|||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
runCfg: run.Config{
|
runCfg: run.Config{
|
||||||
Debug: cfg.Debug,
|
Debug: cfg.Debug,
|
||||||
Values: cfg.Values,
|
|
||||||
StringValues: cfg.StringValues,
|
|
||||||
ValuesFiles: cfg.ValuesFiles,
|
|
||||||
Namespace: cfg.Namespace,
|
Namespace: cfg.Namespace,
|
||||||
Stdout: cfg.Stdout,
|
Stdout: cfg.Stdout,
|
||||||
Stderr: cfg.Stderr,
|
Stderr: cfg.Stderr,
|
||||||
@@ -106,9 +103,14 @@ var upgrade = func(cfg Config) []Step {
|
|||||||
ChartVersion: cfg.ChartVersion,
|
ChartVersion: cfg.ChartVersion,
|
||||||
DryRun: cfg.DryRun,
|
DryRun: cfg.DryRun,
|
||||||
Wait: cfg.Wait,
|
Wait: cfg.Wait,
|
||||||
|
Values: cfg.Values,
|
||||||
|
StringValues: cfg.StringValues,
|
||||||
|
ValuesFiles: cfg.ValuesFiles,
|
||||||
ReuseValues: cfg.ReuseValues,
|
ReuseValues: cfg.ReuseValues,
|
||||||
Timeout: cfg.Timeout,
|
Timeout: cfg.Timeout,
|
||||||
Force: cfg.Force,
|
Force: cfg.Force,
|
||||||
|
Atomic: cfg.AtomicUpgrade,
|
||||||
|
CleanupOnFail: cfg.CleanupOnFail,
|
||||||
})
|
})
|
||||||
|
|
||||||
return steps
|
return steps
|
||||||
@@ -122,6 +124,7 @@ var uninstall = func(cfg Config) []Step {
|
|||||||
steps = append(steps, &run.Uninstall{
|
steps = append(steps, &run.Uninstall{
|
||||||
Release: cfg.Release,
|
Release: cfg.Release,
|
||||||
DryRun: cfg.DryRun,
|
DryRun: cfg.DryRun,
|
||||||
|
KeepHistory: cfg.KeepHistory,
|
||||||
})
|
})
|
||||||
|
|
||||||
return steps
|
return steps
|
||||||
@@ -134,6 +137,10 @@ var lint = func(cfg Config) []Step {
|
|||||||
}
|
}
|
||||||
steps = append(steps, &run.Lint{
|
steps = append(steps, &run.Lint{
|
||||||
Chart: cfg.Chart,
|
Chart: cfg.Chart,
|
||||||
|
Values: cfg.Values,
|
||||||
|
StringValues: cfg.StringValues,
|
||||||
|
ValuesFiles: cfg.ValuesFiles,
|
||||||
|
Strict: cfg.LintStrictly,
|
||||||
})
|
})
|
||||||
|
|
||||||
return steps
|
return steps
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ func (suite *PlanTestSuite) TestNewPlan() {
|
|||||||
cfg := Config{
|
cfg := Config{
|
||||||
Command: "help",
|
Command: "help",
|
||||||
Debug: false,
|
Debug: false,
|
||||||
Values: "steadfastness,forthrightness",
|
|
||||||
StringValues: "tensile_strength,flexibility",
|
|
||||||
ValuesFiles: []string{"/root/price_inventory.yml"},
|
|
||||||
Namespace: "outer",
|
Namespace: "outer",
|
||||||
Stdout: &stdout,
|
Stdout: &stdout,
|
||||||
Stderr: &stderr,
|
Stderr: &stderr,
|
||||||
@@ -45,9 +42,6 @@ func (suite *PlanTestSuite) TestNewPlan() {
|
|||||||
|
|
||||||
runCfg := run.Config{
|
runCfg := run.Config{
|
||||||
Debug: false,
|
Debug: false,
|
||||||
Values: "steadfastness,forthrightness",
|
|
||||||
StringValues: "tensile_strength,flexibility",
|
|
||||||
ValuesFiles: []string{"/root/price_inventory.yml"},
|
|
||||||
Namespace: "outer",
|
Namespace: "outer",
|
||||||
Stdout: &stdout,
|
Stdout: &stdout,
|
||||||
Stderr: &stderr,
|
Stderr: &stderr,
|
||||||
@@ -139,11 +133,16 @@ func (suite *PlanTestSuite) TestUpgrade() {
|
|||||||
ChartVersion: "seventeen",
|
ChartVersion: "seventeen",
|
||||||
DryRun: true,
|
DryRun: true,
|
||||||
Wait: true,
|
Wait: true,
|
||||||
|
Values: "steadfastness,forthrightness",
|
||||||
|
StringValues: "tensile_strength,flexibility",
|
||||||
|
ValuesFiles: []string{"/root/price_inventory.yml"},
|
||||||
ReuseValues: true,
|
ReuseValues: true,
|
||||||
Timeout: "go sit in the corner",
|
Timeout: "go sit in the corner",
|
||||||
Chart: "billboard_top_100",
|
Chart: "billboard_top_100",
|
||||||
Release: "post_malone_circles",
|
Release: "post_malone_circles",
|
||||||
Force: true,
|
Force: true,
|
||||||
|
AtomicUpgrade: true,
|
||||||
|
CleanupOnFail: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
steps := upgrade(cfg)
|
steps := upgrade(cfg)
|
||||||
@@ -159,9 +158,14 @@ func (suite *PlanTestSuite) TestUpgrade() {
|
|||||||
ChartVersion: cfg.ChartVersion,
|
ChartVersion: cfg.ChartVersion,
|
||||||
DryRun: true,
|
DryRun: true,
|
||||||
Wait: cfg.Wait,
|
Wait: cfg.Wait,
|
||||||
|
Values: "steadfastness,forthrightness",
|
||||||
|
StringValues: "tensile_strength,flexibility",
|
||||||
|
ValuesFiles: []string{"/root/price_inventory.yml"},
|
||||||
ReuseValues: cfg.ReuseValues,
|
ReuseValues: cfg.ReuseValues,
|
||||||
Timeout: cfg.Timeout,
|
Timeout: cfg.Timeout,
|
||||||
Force: cfg.Force,
|
Force: cfg.Force,
|
||||||
|
Atomic: true,
|
||||||
|
CleanupOnFail: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
suite.Equal(expected, upgrade)
|
suite.Equal(expected, upgrade)
|
||||||
@@ -198,6 +202,7 @@ func (suite *PlanTestSuite) TestUninstall() {
|
|||||||
DryRun: true,
|
DryRun: true,
|
||||||
Timeout: "think about what you did",
|
Timeout: "think about what you did",
|
||||||
Release: "jetta_id_love_to_change_the_world",
|
Release: "jetta_id_love_to_change_the_world",
|
||||||
|
KeepHistory: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
steps := uninstall(cfg)
|
steps := uninstall(cfg)
|
||||||
@@ -222,6 +227,7 @@ func (suite *PlanTestSuite) TestUninstall() {
|
|||||||
expected = &run.Uninstall{
|
expected = &run.Uninstall{
|
||||||
Release: "jetta_id_love_to_change_the_world",
|
Release: "jetta_id_love_to_change_the_world",
|
||||||
DryRun: true,
|
DryRun: true,
|
||||||
|
KeepHistory: true,
|
||||||
}
|
}
|
||||||
suite.Equal(expected, actual)
|
suite.Equal(expected, actual)
|
||||||
}
|
}
|
||||||
@@ -300,6 +306,10 @@ func (suite *PlanTestSuite) TestAddRepos() {
|
|||||||
func (suite *PlanTestSuite) TestLint() {
|
func (suite *PlanTestSuite) TestLint() {
|
||||||
cfg := Config{
|
cfg := Config{
|
||||||
Chart: "./flow",
|
Chart: "./flow",
|
||||||
|
Values: "steadfastness,forthrightness",
|
||||||
|
StringValues: "tensile_strength,flexibility",
|
||||||
|
ValuesFiles: []string{"/root/price_inventory.yml"},
|
||||||
|
LintStrictly: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
steps := lint(cfg)
|
steps := lint(cfg)
|
||||||
@@ -307,6 +317,10 @@ func (suite *PlanTestSuite) TestLint() {
|
|||||||
|
|
||||||
want := &run.Lint{
|
want := &run.Lint{
|
||||||
Chart: "./flow",
|
Chart: "./flow",
|
||||||
|
Values: "steadfastness,forthrightness",
|
||||||
|
StringValues: "tensile_strength,flexibility",
|
||||||
|
ValuesFiles: []string{"/root/price_inventory.yml"},
|
||||||
|
Strict: true,
|
||||||
}
|
}
|
||||||
suite.Equal(want, steps[0])
|
suite.Equal(want, steps[0])
|
||||||
}
|
}
|
||||||
@@ -356,7 +370,7 @@ func (suite *PlanTestSuite) TestDeterminePlanUninstallCommand() {
|
|||||||
suite.Same(&uninstall, stepsMaker)
|
suite.Same(&uninstall, stepsMaker)
|
||||||
}
|
}
|
||||||
|
|
||||||
// helm_command = delete is provided as an alias for backwards-compatibility with drone-helm
|
// helm_command = delete is provided as an alias for backward-compatibility with drone-helm
|
||||||
func (suite *PlanTestSuite) TestDeterminePlanDeleteCommand() {
|
func (suite *PlanTestSuite) TestDeterminePlanDeleteCommand() {
|
||||||
cfg := Config{
|
cfg := Config{
|
||||||
Command: "delete",
|
Command: "delete",
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ import (
|
|||||||
// Config contains configuration applicable to all helm commands
|
// Config contains configuration applicable to all helm commands
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Debug bool
|
Debug bool
|
||||||
Values string
|
|
||||||
StringValues string
|
|
||||||
ValuesFiles []string
|
|
||||||
Namespace string
|
Namespace string
|
||||||
Stdout io.Writer
|
Stdout io.Writer
|
||||||
Stderr io.Writer
|
Stderr io.Writer
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import (
|
|||||||
// Lint is an execution step that calls `helm lint` when executed.
|
// Lint is an execution step that calls `helm lint` when executed.
|
||||||
type Lint struct {
|
type Lint struct {
|
||||||
Chart string
|
Chart string
|
||||||
|
Values string
|
||||||
|
StringValues string
|
||||||
|
ValuesFiles []string
|
||||||
|
Strict bool
|
||||||
cmd cmd
|
cmd cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,15 +36,18 @@ func (l *Lint) Prepare(cfg Config) error {
|
|||||||
|
|
||||||
args = append(args, "lint")
|
args = append(args, "lint")
|
||||||
|
|
||||||
if cfg.Values != "" {
|
if l.Values != "" {
|
||||||
args = append(args, "--set", cfg.Values)
|
args = append(args, "--set", l.Values)
|
||||||
}
|
}
|
||||||
if cfg.StringValues != "" {
|
if l.StringValues != "" {
|
||||||
args = append(args, "--set-string", cfg.StringValues)
|
args = append(args, "--set-string", l.StringValues)
|
||||||
}
|
}
|
||||||
for _, vFile := range cfg.ValuesFiles {
|
for _, vFile := range l.ValuesFiles {
|
||||||
args = append(args, "--values", vFile)
|
args = append(args, "--values", vFile)
|
||||||
}
|
}
|
||||||
|
if l.Strict {
|
||||||
|
args = append(args, "--strict")
|
||||||
|
}
|
||||||
|
|
||||||
args = append(args, l.Chart)
|
args = append(args, l.Chart)
|
||||||
|
|
||||||
|
|||||||
@@ -80,14 +80,14 @@ func (suite *LintTestSuite) TestPrepareRequiresChart() {
|
|||||||
func (suite *LintTestSuite) TestPrepareWithLintFlags() {
|
func (suite *LintTestSuite) TestPrepareWithLintFlags() {
|
||||||
defer suite.ctrl.Finish()
|
defer suite.ctrl.Finish()
|
||||||
|
|
||||||
cfg := Config{
|
cfg := Config{}
|
||||||
Values: "width=5",
|
|
||||||
StringValues: "version=2.0",
|
|
||||||
ValuesFiles: []string{"/usr/local/underrides", "/usr/local/overrides"},
|
|
||||||
}
|
|
||||||
|
|
||||||
l := Lint{
|
l := Lint{
|
||||||
Chart: "./uk/top_40",
|
Chart: "./uk/top_40",
|
||||||
|
Values: "width=5",
|
||||||
|
StringValues: "version=2.0",
|
||||||
|
ValuesFiles: []string{"/usr/local/underrides", "/usr/local/overrides"},
|
||||||
|
Strict: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
command = func(path string, args ...string) cmd {
|
command = func(path string, args ...string) cmd {
|
||||||
@@ -97,6 +97,7 @@ func (suite *LintTestSuite) TestPrepareWithLintFlags() {
|
|||||||
"--set-string", "version=2.0",
|
"--set-string", "version=2.0",
|
||||||
"--values", "/usr/local/underrides",
|
"--values", "/usr/local/underrides",
|
||||||
"--values", "/usr/local/overrides",
|
"--values", "/usr/local/overrides",
|
||||||
|
"--strict",
|
||||||
"./uk/top_40"}, args)
|
"./uk/top_40"}, args)
|
||||||
|
|
||||||
return suite.mockCmd
|
return suite.mockCmd
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
type Uninstall struct {
|
type Uninstall struct {
|
||||||
Release string
|
Release string
|
||||||
DryRun bool
|
DryRun bool
|
||||||
|
KeepHistory bool
|
||||||
cmd cmd
|
cmd cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,6 +37,9 @@ func (u *Uninstall) Prepare(cfg Config) error {
|
|||||||
if u.DryRun {
|
if u.DryRun {
|
||||||
args = append(args, "--dry-run")
|
args = append(args, "--dry-run")
|
||||||
}
|
}
|
||||||
|
if u.KeepHistory {
|
||||||
|
args = append(args, "--keep-history")
|
||||||
|
}
|
||||||
|
|
||||||
args = append(args, u.Release)
|
args = append(args, u.Release)
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,21 @@ func (suite *UninstallTestSuite) TestPrepareDryRunFlag() {
|
|||||||
suite.Equal(expected, suite.actualArgs)
|
suite.Equal(expected, suite.actualArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *UninstallTestSuite) TestPrepareKeepHistoryFlag() {
|
||||||
|
u := Uninstall{
|
||||||
|
Release: "perturbator_sentient",
|
||||||
|
KeepHistory: true,
|
||||||
|
}
|
||||||
|
cfg := Config{}
|
||||||
|
|
||||||
|
suite.mockCmd.EXPECT().Stdout(gomock.Any()).AnyTimes()
|
||||||
|
suite.mockCmd.EXPECT().Stderr(gomock.Any()).AnyTimes()
|
||||||
|
|
||||||
|
suite.NoError(u.Prepare(cfg))
|
||||||
|
expected := []string{"uninstall", "--keep-history", "perturbator_sentient"}
|
||||||
|
suite.Equal(expected, suite.actualArgs)
|
||||||
|
}
|
||||||
|
|
||||||
func (suite *UninstallTestSuite) TestPrepareNamespaceFlag() {
|
func (suite *UninstallTestSuite) TestPrepareNamespaceFlag() {
|
||||||
u := Uninstall{
|
u := Uninstall{
|
||||||
Release: "carly_simon_run_away_with_me",
|
Release: "carly_simon_run_away_with_me",
|
||||||
|
|||||||
@@ -12,9 +12,14 @@ type Upgrade struct {
|
|||||||
ChartVersion string
|
ChartVersion string
|
||||||
DryRun bool
|
DryRun bool
|
||||||
Wait bool
|
Wait bool
|
||||||
|
Values string
|
||||||
|
StringValues string
|
||||||
|
ValuesFiles []string
|
||||||
ReuseValues bool
|
ReuseValues bool
|
||||||
Timeout string
|
Timeout string
|
||||||
Force bool
|
Force bool
|
||||||
|
Atomic bool
|
||||||
|
CleanupOnFail bool
|
||||||
|
|
||||||
cmd cmd
|
cmd cmd
|
||||||
}
|
}
|
||||||
@@ -62,13 +67,19 @@ func (u *Upgrade) Prepare(cfg Config) error {
|
|||||||
if u.Force {
|
if u.Force {
|
||||||
args = append(args, "--force")
|
args = append(args, "--force")
|
||||||
}
|
}
|
||||||
if cfg.Values != "" {
|
if u.Atomic {
|
||||||
args = append(args, "--set", cfg.Values)
|
args = append(args, "--atomic")
|
||||||
}
|
}
|
||||||
if cfg.StringValues != "" {
|
if u.CleanupOnFail {
|
||||||
args = append(args, "--set-string", cfg.StringValues)
|
args = append(args, "--cleanup-on-fail")
|
||||||
}
|
}
|
||||||
for _, vFile := range cfg.ValuesFiles {
|
if u.Values != "" {
|
||||||
|
args = append(args, "--set", u.Values)
|
||||||
|
}
|
||||||
|
if u.StringValues != "" {
|
||||||
|
args = append(args, "--set-string", u.StringValues)
|
||||||
|
}
|
||||||
|
for _, vFile := range u.ValuesFiles {
|
||||||
args = append(args, "--values", vFile)
|
args = append(args, "--values", vFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,20 +91,21 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
|
|||||||
u := Upgrade{
|
u := Upgrade{
|
||||||
Chart: "hot_ac",
|
Chart: "hot_ac",
|
||||||
Release: "maroon_5_memories",
|
Release: "maroon_5_memories",
|
||||||
ChartVersion: "radio_edit", //-version
|
ChartVersion: "radio_edit",
|
||||||
DryRun: true, //-run
|
DryRun: true,
|
||||||
Wait: true, //-wait
|
Wait: true,
|
||||||
ReuseValues: true, //-values
|
|
||||||
Timeout: "sit_in_the_corner", //-timeout
|
|
||||||
Force: true, //-force
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg := Config{
|
|
||||||
Values: "age=35",
|
Values: "age=35",
|
||||||
StringValues: "height=5ft10in",
|
StringValues: "height=5ft10in",
|
||||||
ValuesFiles: []string{"/usr/local/stats", "/usr/local/grades"},
|
ValuesFiles: []string{"/usr/local/stats", "/usr/local/grades"},
|
||||||
|
ReuseValues: true,
|
||||||
|
Timeout: "sit_in_the_corner",
|
||||||
|
Force: true,
|
||||||
|
Atomic: true,
|
||||||
|
CleanupOnFail: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg := Config{}
|
||||||
|
|
||||||
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",
|
suite.Equal([]string{"upgrade", "--install",
|
||||||
@@ -114,6 +115,8 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
|
|||||||
"--reuse-values",
|
"--reuse-values",
|
||||||
"--timeout", "sit_in_the_corner",
|
"--timeout", "sit_in_the_corner",
|
||||||
"--force",
|
"--force",
|
||||||
|
"--atomic",
|
||||||
|
"--cleanup-on-fail",
|
||||||
"--set", "age=35",
|
"--set", "age=35",
|
||||||
"--set-string", "height=5ft10in",
|
"--set-string", "height=5ft10in",
|
||||||
"--values", "/usr/local/stats",
|
"--values", "/usr/local/stats",
|
||||||
|
|||||||
Reference in New Issue
Block a user