1
0
mirror of https://github.com/helm/chart-testing.git synced 2026-02-05 18:45:18 +01:00
Commit Graph

48 Commits

Author SHA1 Message Date
Reinhard Nägele
2407e7df46 Log invalid chart dirs to stderr (#290)
If directories are deleted from a chart, ct detects them as invalid
chart directories. A log message is printed to stdout which messes up
the regular output. In order to fix this, the message is now logged to
stderr.

*Example:*

```
$ ct list-changed
Directory 'charts/mychart/templates/deleted' is not a valid chart directory. Skipping...
charts/mychart
```

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2020-10-29 15:02:17 +01:00
Eric
ec7b0c779b Add option to exclude deprecated charts (#280) 2020-10-27 08:44:13 +01:00
MengZeLee
21e0f7a1d3 Fix typo (#284)
Signed-off-by: MengZn <adnt587@gmail.com>
2020-10-27 08:01:59 +01:00
Torsten Walter
e4d7b78183 Support execution of additional commands during ct lint (#283)
* support execution of additional commands for lint

Given that helm unittest is installed locally or mounted into the chart
testing container one could use this to run helm unittest for each
chart.

```
additional-commands:
 - helm unittest --helm3 -f tests/*.yaml {{ .Path }}
```

The command is treated as a go template. Like this it's possible to get
the path to the chart as in the example. It would also be open for
further extension if needed.

Signed-off-by: Torsten Walter <mail@torstenwalter.de>

* Use sh to execute command

Signed-off-by: Torsten Walter <mail@torstenwalter.de>

Co-authored-by: Reinhard Nägele <unguiculus@gmail.com>

* rename function to NewCmdTemplateExecutor

Signed-off-by: Torsten Walter <mail@torstenwalter.de>

* add error handling

Signed-off-by: Torsten Walter <mail@torstenwalter.de>

* add documentation

Signed-off-by: Torsten Walter <mail@torstenwalter.de>

* use go-shellwords to split rendered command

Signed-off-by: Torsten Walter <mail@torstenwalter.de>

* Update pkg/tool/cmdexecutor.go

Signed-off-by: Torsten Walter <mail@torstenwalter.de>

Co-authored-by: Reinhard Nägele <unguiculus@gmail.com>

* add unit tests

Signed-off-by: Torsten Walter <mail@torstenwalter.de>

Co-authored-by: Reinhard Nägele <unguiculus@gmail.com>
2020-10-20 17:10:56 -04:00
Reinhard Nägele
43b9ced061 Print config to stderr (#277)
Fixes a regression when the config file used is printed
to stdout even when the list-changed command is run. It is
now only printed when --print-config=true. Also, config printing
is now done to stderr so the flag can also be used in combination
with the list-changed command.

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2020-09-25 22:22:43 +02:00
Reinhard Nägele
b3899d2ce9 Add flag for disabling config printing (#269)
By default, ct prints the config on startup. This can be problematic
because it may contain senstivie data when helm-repo-extra-args contains
passwords. The new flag enables turning off config printing and disables
it by default.

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2020-09-09 21:26:06 +02:00
Scott Leggett
98f1d4896b Fix int to string conversion (#262)
The old code was incorrect and no longer builds with Go 1.15.

Signed-off-by: Scott Leggett <scott@sl.id.au>
2020-08-26 22:16:07 +02:00
Reinhard Nägele
50db473a1e Add Homebrew installer (#244)
The Homebrew formula installs the config files to Homebrew's
etc directory, so we add that to the search locations for config files.

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2020-07-24 22:32:42 +02:00
Marc Sensenich
93b10e8e55 Add since flag for changing the reference branch for git merge-base (#229) 2020-07-24 22:12:55 +02:00
Reinhard Nägele
f5f1e7786b Don't create provided namespace (#205)
Adding support for Helm 3 introduced creating namespaces
because Helm does not do this automatically anymore.
However, a regression was introduced that always creates
namespaces, even if a dedicated namespace is provided via
CLI flag.

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>

* Fix statefulset test

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>

* Fix deployment apiVersion

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>

* Create custom namespace before test

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>
2020-02-27 18:45:38 +01:00
Reinhard Nägele
62e23acd9f Update docs for Helm 3 (#194)
Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>
2019-12-13 16:18:11 +01:00
jeff-knurek
b9d4ad0a41 List changed fixes (#190)
Signed-off-by: Jeff Knurek <j.knurek@travelaudience.com>
2019-12-08 20:05:25 +01:00
Reinhard Nägele
b8572749f0 Add support for Helm 3 (#184)
Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>
2019-11-28 19:09:20 +01:00
Reinhard Nägele
5b7b21e064 Migrate to Go modules (#183)
* Migrate to Go modules

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>

* Add 'go mod download'

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>

* Update machine image

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>

* Install Go

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>

* Fix Go installation

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>

* Fix Go installation

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>

* Override Go link

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>

* Do checkout first

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>

* Fix link

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>

* Copy go 1.13 binary in place of circle image default binary

Signed-off-by: Scott Rigby <scott@r6by.com>

* Use latest helm v3 version, and remove install_tiller function

Signed-off-by: Scott Rigby <scott@r6by.com>

* Revert "Use latest helm v3 version, and remove install_tiller function"

This reverts commit 63dedab3a2.

Signed-off-by: Scott Rigby <scott@r6by.com>

* Copy full go 1.13 dir into the circle machine default location after deleting initial install

Signed-off-by: Scott Rigby <scott@r6by.com>
2019-11-02 15:44:02 -04:00
Reinhard Nägele
e731d947fb Consider username and password in repo urls (#162)
Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>
2019-07-09 07:24:17 +02:00
Reinhard Nägele
f53c402ee2 Print events on cleanup (#155)
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2019-05-03 08:07:18 +02:00
Reinhard Nägele
e2e0c8cea3 Fix log messages (#152)
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2019-04-25 18:39:03 +02:00
Reinhard Nägele
f1712a6b22 Trim leading invalid chars from names (#151)
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2019-04-24 22:25:54 +02:00
Carlos Tadeu Panato Junior
961a3ab920 Remove force delete of pv and improve cleanup logic (#150)
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
2019-04-24 22:25:13 +02:00
Reinhard Nägele
bc772e2051 Trim leading hyphens from names (#143)
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2019-04-22 18:02:20 +02:00
Jacob LeGrone
b060fc83f2 Add git version documentation, rename worktree methods, and handle existing worktree (#133)
Signed-off-by: Jacob LeGrone <git@jacob.work>
2019-03-28 21:46:30 +01:00
Jacob LeGrone
ea18dc6af1 fix(account): handle invalid repository domain matches (#137)
fixes #136 

Signed-off-by: Jacob LeGrone <git@jacob.work>
2019-03-28 20:55:55 +01:00
Jacob LeGrone
acfb89768e Add option to skip upgrade testing of deleted/renamed values files (#132)
* feat(upgrade): allow skipping missing values files

This allows fixing previous chart versions in a single pull request
without applying a major version bump to the chart version.

Signed-off-by: Jacob LeGrone <git@jacob.work>

* test(skip-missing-values): validate config and HasCIValuesFile method

Signed-off-by: Jacob LeGrone <git@jacob.work>

* docs(skip-missing-values): generate documentation

Signed-off-by: Jacob LeGrone <git@jacob.work>

* fix(chart): switch to filepath from path

Signed-off-by: Jacob LeGrone <git@jacob.work>
2019-03-25 13:53:21 -04:00
Jacob LeGrone
52a4be9561 Add Helm/Kubernetes integration tests (#120)
* Add helm/kubectl integration test

Signed-off-by: Jacob LeGrone <git@jacob.work>

* Use Chart type from integration tests

Signed-off-by: Jacob LeGrone <git@jacob.work>

* Update .circleci/config.yml

Co-Authored-By: jlegrone <jlegrone@users.noreply.github.com>
Signed-off-by: Jacob LeGrone <git@jacob.work>

* Remove extraneous test chart files

Signed-off-by: Jacob LeGrone <git@jacob.work>

* Fix shellcheck lint

Signed-off-by: Jacob LeGrone <git@jacob.work>

* Remove example kind config from e2e tests

Signed-off-by: Jacob LeGrone <git@jacob.work>

* Remove breaking semver test

This wasn't super clear and was no longer working properly
after the switch to git-worktree.

Signed-off-by: Jacob LeGrone <git@jacob.work>

* Bump kind version

Signed-off-by: Jacob LeGrone <git@jacob.work>
2019-03-25 13:47:22 -04:00
Jacob LeGrone
8ddee49c8b Handle empty chart path, add Chart type (#104)
Signed-off-by: Jacob LeGrone <git@jacob.work>
2019-03-21 10:09:48 +01:00
Jacob LeGrone
de59b1cdfb Test chart upgrades (#103)
* Test chart upgrades against previous version

Upgrade testing will be run if the --upgrade flag is set (default true)
and chart version increment does not indicate a breaking change
according to the SemVer 2.0 spec.

Any releases associated with previous chart versions which fail to roll
out or for which an initial `helm test` fails will be ignored.

Signed-off-by: Jacob LeGrone <git@jacob.work>

* fix(dep): add version constraint for github.com/otiai10/copy

Signed-off-by: Jacob LeGrone <git@jacob.work>

* refactor(git): checkout whole repository with worktree

Signed-off-by: Jacob LeGrone <git@jacob.work>

* Rename test* to do*

Signed-off-by: Jacob LeGrone <git@jacob.work>

* Return bool, error from BreakingChangeAllowed

Signed-off-by: Jacob LeGrone <git@jacob.work>

* Use errors.Wrapf

Co-Authored-By: jlegrone <jlegrone@users.noreply.github.com>
Signed-off-by: Jacob LeGrone <git@jacob.work>

* Explicitly disable upgrade when not install

Signed-off-by: Jacob LeGrone <git@jacob.work>
2019-03-18 11:11:57 -04:00
Reinhard Nägele
27b25831d9 Fix gofmt errors (#122) 2019-03-05 09:57:03 +01:00
Carlos Tadeu Panato Junior
010642b8fe Force the namespace deletion by updating the finalizers in the namespace obj (#112)
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
2019-03-04 18:32:33 +01:00
Carlos Tadeu Panato Junior
ebf0014515 Add explicit deletion of pv and pvcs (#119)
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
2019-02-28 14:10:08 +01:00
Reinhard Nägele
d69c43e71b Add list-changed command (#98)
Allows to identify chart changes before actually running
lint or install commands. This can be useful in the following
cases:

* In a CI setup where kind clusters are spun up on the fly,
  this makes it possible to decide whether a cluster is necessary
  at all. A PR may only contain changes that are not relevant
  to any charts.
* By knowing upfront which charts have changed, it is
  possible to load a per-chart CI configuration which would
  allows us to determine the number of nodes needed in a kind
  cluster. For most charts, one node is enough, but in certain
  scenarios, especially for StatefulSets, we may want to test
  with pod anti-affinity where replicas have to be spread across
  multiple nodes.

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2019-01-31 17:17:25 +01:00
Reinhard Nägele
3e4f4f88fa Log values files used (#96)
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2019-01-24 11:14:17 -05:00
Reinhard Nägele
9e980f87cc Use visitor to bind flags to Viper (#92)
Simplifies the logic and no longer requires that flags be
listed individually in order to get bound.

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2019-01-24 09:26:43 -05:00
Reinhard Nägele
868038e2e8 Improve error logging (#91)
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2019-01-23 19:15:12 +01:00
Reinhard Nägele
374227938c Require charts to be in direct subdirectories of configured charts dirs (#90)
Fixes a regression introduced in #73 so that chart directories were no longer required to be in a direct subdirectory of configured chart directories.

This caused problems in https://github.com/helm/charts/pull/10830.

cc @munnerz
2019-01-23 15:26:46 +01:00
Reinhard Nägele
ee1bd9e090 Only require validation configs when validation is enabled (#87)
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2019-01-22 08:05:42 -05:00
Reinhard Nägele
b679b85de0 Fix regression in changed chart detection (#85)
* Fix regression in changed chart detection

 Please enter the commit message for your changes. Lines starting

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Refactor to consider charts at root

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Make sure charts are processed only once

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Fix typo

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2019-01-20 17:15:48 -05:00
Reinhard Nägele
fa29453c5b Use anonymous function to avoid defer in loop (#86)
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2019-01-19 11:39:37 +01:00
Markus Maga
9084cf16d0 Add support for providing credentials when adding chart-repositories (#67)
Signed-off-by: Markus Maga <markus@nadilus.com>
2019-01-07 21:13:30 +01:00
Adam Kunicki
7b167f8fe0 Fix index out of range when files exist in the root of a chart dir (#73)
Signed-off-by: Adam Kunicki <adam@streamsets.com>
2019-01-04 15:09:30 +01:00
Carlos Tadeu Panato Junior
46dc82e972 Add new flags to disable lint/schema validation (#68)
Signed-off-by: cpanato <ctadeu@gmail.com>
2018-12-21 07:44:55 +01:00
Reinhard Nägele
d3c13acf95 Truncate names to 63 characters (#69)
There are charts with very long names which cause namespace and
release names to exceed the max length of 63 characters. We, thus,
need to truncate long names. Truncation is done from the left in
order to preserve build ids and randomly generated suffixes.

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2018-12-20 12:08:31 -05:00
Jacob LeGrone
3ce597ad11 feat(lint): validate values files in ci directory (#66)
Signed-off-by: Jacob LeGrone <git@jacob.work>
2018-12-18 17:17:55 +01:00
Jacob LeGrone
228603701a Support installation to existing namespace (#59)
This PR adds two flags to the `install` command: `namespace` and `release-label`. If `namespace` is specified, releases will target that namespace and `release-label` will be used to select deployments and pods for readiness and reading log output.

Fixes #34
2018-12-14 15:30:36 +01:00
Reinhard Nägele
09eff4860c Fix typos (#65) 2018-12-10 17:33:34 +01:00
Reinhard Nägele
739aa607a8 Fix readiness check (#57)
Readiness check should happen before tests are executed. Otherwise
the fails if there are tests and test pods match the label selectors
that identify pods. Since test pods have status Completed, they
cause the readiness check to fail.

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2018-11-16 13:53:53 +01:00
Bernhard (Sonny) Köhler
b1c8894732 fixes bug inside of LintChart() (#55)
ValidateMaintainers() should only be called when the respective config
element is set to true.

Signed-off-by: Sonny Garcia <sonnygarcia@icloud.com>
2018-11-16 13:30:10 +01:00
Reinhard Nägele
73f35d7fcb Explicitly disable version checks when all or specific charts are tested (#56)
It is already documented that the check is disabled in this case.

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2018-11-16 13:25:34 +01:00
Reinhard Nägele
f632cd5081 Re-write it in Go (#35)
* Re-write it in Go

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Fix loading config from home dir

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Print config

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Remove git gc test code

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Remove year in copyright header

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Add alias for lint-and-install

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Fix examples

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Remove OWNERS file

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Add docs generation

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Update CircleCI

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Update readme

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Document building and releasing

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Remove Makefile

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Hide doc-gen command

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Add support for Helm extra args

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Update tool dependencies

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Update Goreleaser

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Upgrade pip

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Update Gopkg.lock

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Add log messages

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Fix CircleCI env var for tag

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Add Docker login

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Readme update for MacOS (#1)

* Add build.sh mac prerequisites, and README markdown linting fixes

Signed-off-by: Scott Rigby <scott@r6by.com>

* Update README.md

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Update Gopkg.lock

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Update config search locations

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Add config files to distro

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Add debug flag

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Add note on config files for linting

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Fix link

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Revert "Update Gopkg.lock"

This reverts commit fcbfbdc9db.

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Fix link

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>

* Fix readme

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
2018-11-07 13:06:20 -05:00