Commit graph

133 commits

Author SHA1 Message Date
Martin Hickey
699ea6dcef
Merge pull request #9066 from scaat/fix-specification
[FIX]Unified go specification
2021-06-02 11:55:53 +01:00
Mark Sagi-Kazar
d5b4e1c5b8
chore: update testdata to use the new ingress template
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-04-25 12:23:03 +02:00
Adam Reese
213a7df2dc
Merge pull request #9416 from croomes/resource-name-validation
Add name validation rules for different object kinds
2021-03-26 10:25:49 -07:00
Simon Croome
6c82c83b3a
Wrap validation error instead of recreating
Signed-off-by: Simon Croome <simon.croome@storageos.com>
2021-03-22 15:59:07 +00:00
Simon Croome
54de1c1f25
Move default to avoid nil check
Signed-off-by: Simon Croome <simon.croome@storageos.com>
2021-03-22 15:59:06 +00:00
Simon Croome
ba325bdf7e
Add name validation rules for object kinds
Signed-off-by: Simon Croome <simon@croome.org>

Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

Signed-off-by: Simon Croome <simon.croome@storageos.com>
2021-03-22 15:59:06 +00:00
Josh Soref
2bf8fdf45d
chore: Spelling (#9410)
* spelling: annotate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: asserts

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: behavior

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: binary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: contain

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: copied

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependency

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: depending

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deprecated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: doesn't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: donot

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: github

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inputting

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: iteration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: jabberwocky

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: kubernetes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: length

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: mismatch

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: nonexistent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: outputs

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: panicking

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: plugins

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parsing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: porthos

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: regular

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: resource

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: repositories

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: something

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: strict

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: string

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unknown

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-15 21:11:57 -04:00
Matthew Luckam
592c338242 updated unit tests to conform with helm best practices
Signed-off-by: Matthew Luckam <Matthew.Luckam@peraton.com>
2021-03-03 11:18:34 -05:00
Matthew Luckam
f402994461 corrected order of helm lint coalescing of multiple values files
Signed-off-by: Matthew Luckam <Matthew.Luckam@peraton.com>
2021-03-03 11:18:34 -05:00
Joe Julian
fdcd22ef58
Reduce linting severity for users of out-of-date kubernetes (#8608)
* Reduce linting severity for users of out-of-date kubernetes

Fixes #8596

Signed-off-by: Joe Julian <me@joejulian.name>

* add more verbose deprecation info

Signed-off-by: Joe Julian <me@joejulian.name>

* use new upstream deprecations

Signed-off-by: Joe Julian <me@joejulian.name>

* do not error for custom resources

Signed-off-by: Joe Julian <me@joejulian.name>

* Define deprecation version in lint rules by LDFLAG

Signed-off-by: Joe Julian <me@joejulian.name>

* make comment clearer

Signed-off-by: Joe Julian <me@joejulian.name>

* Extend the k8s version discovery and constants to chartutil

Signed-off-by: Joe Julian <me@joejulian.name>

* remove awk dependency

Signed-off-by: Joe Julian <me@joejulian.name>

* align k8s version constant names between capabilities.go and deprecations.go

Signed-off-by: Joe Julian <me@joejulian.name>

* show the error if the unexpected happens

Signed-off-by: Joe Julian <me@joejulian.name>

* bump k8sVersionMinor and golden chart templates for k8s 1.20

Signed-off-by: Joe Julian <me@joejulian.name>

* bump for tests to match 1.20.1

Signed-off-by: Joe Julian <me@joejulian.name>
2021-01-05 16:05:33 -07:00
rimas
f30badd570 Fix test
Signed-off-by: rimas <rmocius@gmail.com>
2020-12-01 18:52:57 +02:00
rimas
ce1a46899f Fixes #9083
Signed-off-by: rimas <rmocius@gmail.com>
2020-12-01 18:50:14 +02:00
Scaat Feng
9020c95fb1 [FIX]comment should start with whitespace
Signed-off-by: Scaat Feng <scaat.feng@gmail.com>
2020-11-26 14:11:27 +08:00
Nandor Kracser
dfb5a5e8cc
lint: lint all documents in a multi-doc yaml file
Signed-off-by: Nandor Kracser <bonifaido@gmail.com>
2020-11-06 14:14:19 +01:00
Christophe VILA
8a4c0bc7b1 added test for https://github.com/helm/helm/pull/8913 related to https://github.com/helm/helm/issues/8621
Signed-off-by: Christophe VILA <christophe.vila@thalesgroup.com>
2020-10-27 23:06:01 +01:00
Christophe VILA
f736af95eb do not check YAML if nothing was parsed
Signed-off-by: Christophe VILA <christophe.vila@thalesgroup.com>
2020-10-22 00:15:37 +02:00
Matt Butcher
fe2d7f7792
this rewrites a whole bunch of old repo URLs to the new repo URL (#8902)
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-10-19 14:38:32 -06:00
Matt Butcher
ed5fba5142
refactor the release name validation to be consistent across Helm
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-09-17 11:34:31 -06:00
Matt Butcher
04fb35814f
Fixed a variable name collision caused by two PR merges (#8681)
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-09-01 11:51:40 -06:00
Matt Butcher
70d03e5cef
Fix/8467 linter failing (#8496)
* add output to get debug info on linter failing

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* trap cases where the YAML indent is incorrect.

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-09-01 10:45:59 -06:00
Matt Butcher
96d9ab9663
fix name length check on lint (#8543)
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-09-01 10:44:52 -06:00
Matt Farina
11f658e223
Fixing linting of templates on Windows
When the engine stored templates in the map the keys were generated
based on path and not filepath. filepath was being used in the linter
when retrieving content from the keys. On Windows the keys ended up
being different.

This change is to use path joins to create the lookup key. Since the
name path was used in the code it needed to be changed in order to
import the package.

Tests already exist and were failing on windows. This got in because
CI is not run on Windows.

Closes #6418

Signed-off-by: Matt Farina <matt@mattfarina.com>
2020-08-20 13:08:48 -04:00
Matt Butcher
2750e4d781
Lint dependencies (#7970)
* feat: add dependency tests

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* replaced on-disk fixtures with in-memory fixtures

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-07-09 14:31:51 -06:00
Matthew Fisher
d61aaf3fd7
Merge pull request #7235 from karuppiah7890/fix-lint
Show errors when linting for Chart.yaml version and appVersion fields of type non-string
2020-07-07 10:01:16 -07:00
Matthew Fisher
e7ab975112
Merge pull request #8142 from technosophos/feat/1990-match-labels-lint
feat: Detect missing selector during lint
2020-07-07 08:48:24 -07:00
Karuppiah Natarajan
47c38ec23d
Show errors when linting for Chart.yaml version and appVersion fields of type non-string
Signed-off-by: Karuppiah Natarajan <karuppiah7890@gmail.com>
2020-05-25 13:24:15 +05:30
Matt Farina
dbd001e532
Removing tiller language
Since Tiller is no longer part of Helm v3, internal documentation
language about Tiller can be removed

Signed-off-by: Matt Farina <matt@mattfarina.com>
2020-05-21 15:26:16 -04:00
Matt Butcher
118d46eb3e
feat: Detect missing selector during lint
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-05-15 12:08:15 -06:00
Matt Butcher
59eed4e81f
feat: make the linter coalesce the passed-in values before running values tests (#7984)
* fix: make the linter coalesce the passed-in values before running values tests

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* fixed typo

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-05-12 14:23:25 -06:00
Martin Hickey
e4768e6460 Update lint deprecation list
Add api group:
- apiextensions.k8s.io/v1beta1
- rbac.authorization.k8s.io/v1alpha1

Also, some kinds moved from extensions/v1 to extensions/v1beta1

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
2020-05-05 21:19:07 +00:00
Matt Butcher
08e546f169
fix: removed strict template errors in linter (#8017)
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-05-04 13:55:42 -06:00
Matt Butcher
bf9d629dc0
feat: implement deprecation warnings in helm lint (#7986)
* feat: implement deprecation warnings in helm lint

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* added more deprecated APIs

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-05-01 14:01:15 -06:00
Matt Butcher
6fc9353056
feat: lint the names of templated resources (#8011)
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-04-28 17:12:14 -06:00
Matt Butcher
549193dbcb
test: forward-port regression test from Helm 2 (#7927)
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-04-15 11:48:26 -06:00
Martin Hickey
9a0e7d8a31 Improve error message to check in unit test
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
2020-03-18 12:22:06 +00:00
Martin Hickey
ca931b472b
Merge pull request #7691 from longkb/add_ut_for_values
Add unit test for lint/values.go
2020-03-18 10:38:53 +00:00
Kim Bao Long
9d20e44ad1 Add unit test for lint/values.go
Signed-off-by: Kim Bao Long <longkb@vn.fujitsu.com>
2020-03-18 08:39:07 +07:00
Matt Butcher
16024dc19a
fix: add new static linter and fix issues it found (#7655)
* fix: add new static linter and fix issues it found

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* fixed two additional linter errors.

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-03-03 17:28:57 -07:00
Josh Soref
02ad2b1187 Spelling (#7258)
* spelling: constraint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: cryptographic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependency

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: doesnot

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: don't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unexpected

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dreadnought

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: default

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: envvars

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: evaluates

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: execute

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: extractor

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: frobnitz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: generated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: implementation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: jabba

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: keywords

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: kubernetes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: override

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: package

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parsable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: progress

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: recursively

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: release

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: cache

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: representing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: serializer

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: subchart

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: utilities

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2019-12-18 12:04:08 +00:00
Scott Morgan
32ce016054 fix(lint): Remove requirement that directory name and chart name match
Signed-off-by: Scott Morgan <morgandev@gmail.com>
2019-11-20 08:26:54 -06:00
Scott Morgan
eb833ccead remove unused variable
Signed-off-by: Scott Morgan <morgandev@gmail.com>
2019-11-20 07:46:34 -06:00
Scott Morgan
8a8463e08d fix(lint): Remove requirement that directory name and chart name match
Signed-off-by: Scott Morgan <morgandev@gmail.com>
2019-11-19 17:20:22 -06:00
Taylor Thomas
caf629a3e9 feat(lint): Adds v3 chart checks to linter
Fixes #5733

This adds two specific checks. A warning if a chart has a `crd-install` hook
and an error if the chart contains `.Release.Time`. Further checks can be added
down the road as needed using the same pattern I use here

Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
2019-10-17 12:20:47 -05:00
Matthew Fisher
c1e63a2a17
Merge pull request #6536 from karuppiah7890/fix-lint-for-no-package-found
fix silent lint ignore for non existing packaged charts
2019-10-05 10:57:26 -07:00
Karuppiah Natarajan
bb9426c4e2
fix(pkg/lint): fix lint silently ignoring non existing packaged charts
Closes #6428

Signed-off-by: Karuppiah Natarajan <karuppiah7890@gmail.com>
2019-10-04 21:28:16 +05:30
Matt Farina
9bc7934f35
Updating the module for v3 as the major version
Signed-off-by: Matt Farina <matt@mattfarina.com>
2019-10-03 14:27:05 -04:00
Matt Farina
967f4fed42
Update dependencies
* Kubernetes updated to 1.16.1
* SemVer and Sprig updated to latest releases that leverage go
  modules
* Tests and checks updated. These already landed in v2 via PR 6457

Signed-off-by: Matt Farina <matt@mattfarina.com>
2019-10-03 13:49:07 -04:00
Vibhav Bobade
68a8f36a92 Fix Adding Errors from Linter.Messages to result.Errors
This also fixes <nil> beig added to result.Errors

Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
2019-08-20 04:22:17 +05:30
Martin Hickey
4d47052395 Update linting and checking for apiVersion v1/v2
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
2019-08-02 15:52:14 +01:00
Oleg Sidorov
ec440d446d Replaced ghodss/yaml with sigs.k8s.io/yaml
This commit replaces usage of github.com/ghodss/yaml with it's forked
version maintained by SIG community. The replaced library has
low-to-none support activity unlike the latter. We believe the new
Helm branch could benefit from using the community-supported version on
a long-term run as yaml parser is a key component of Helm chart rendering
engine.

This commit locks sigs.k8s.io/yaml dependency version on 1.1.0 which
is backwards compatible with ghodss/yaml 1.0.0.

This change also resolves the outdated dependency version lock for
ghodss/yaml (currently 1.0.0) and makes it possible to port changes from
https://github.com/helm/helm/pull/6010 to dev-v3.

Signed-off-by: Oleg Sidorov <oleg.sidorov@booking.com>
2019-07-12 16:52:15 +02:00