fixed issues in the lint action script

Signed-off-by: Danilo Patrucco <danilo.patrucco@gmail.com>
pull/13205/head
Danilo Patrucco 1 year ago
parent ac283a5587
commit 8cf9e82063

@ -37,8 +37,10 @@ type Lint struct {
WithSubcharts bool WithSubcharts bool
Quiet bool Quiet bool
KubeVersion *chartutil.KubeVersion KubeVersion *chartutil.KubeVersion
IgnoreFilePath string
} }
// LintResult is the result of Lint // LintResult is the result of Lint
type LintResult struct { type LintResult struct {
TotalChartsLinted int TotalChartsLinted int
@ -51,7 +53,6 @@ func NewLint() *Lint {
return &Lint{} return &Lint{}
} }
// Run executes 'helm Lint' against the given chart.
func (l *Lint) Run(paths []string, vals map[string]interface{}) *LintResult { func (l *Lint) Run(paths []string, vals map[string]interface{}) *LintResult {
lowestTolerance := support.ErrorSev lowestTolerance := support.ErrorSev
if l.Strict { if l.Strict {
@ -59,7 +60,7 @@ func (l *Lint) Run(paths []string, vals map[string]interface{}) *LintResult {
} }
result := &LintResult{} result := &LintResult{}
for _, path := range paths { for _, path := range paths {
linter, err := lintChart(path, vals, l.Namespace, l.KubeVersion) linter, err := lintChart(path, vals, l.Namespace, l.KubeVersion, l.IgnoreFilePath)
if err != nil { if err != nil {
result.Errors = append(result.Errors, err) result.Errors = append(result.Errors, err)
continue continue
@ -76,7 +77,6 @@ func (l *Lint) Run(paths []string, vals map[string]interface{}) *LintResult {
return result return result
} }
// HasWarningsOrErrors checks is LintResult has any warnings or errors
func HasWarningsOrErrors(result *LintResult) bool { func HasWarningsOrErrors(result *LintResult) bool {
for _, msg := range result.Messages { for _, msg := range result.Messages {
if msg.Severity > support.InfoSev { if msg.Severity > support.InfoSev {
@ -86,7 +86,7 @@ func HasWarningsOrErrors(result *LintResult) bool {
return len(result.Errors) > 0 return len(result.Errors) > 0
} }
func lintChart(path string, vals map[string]interface{}, namespace string, kubeVersion *chartutil.KubeVersion) (support.Linter, error) { func lintChart(path string, vals map[string]interface{}, namespace string, kubeVersion *chartutil.KubeVersion, ignoreFilePath string) (support.Linter, error) {
var chartPath string var chartPath string
linter := support.Linter{} linter := support.Linter{}
@ -125,5 +125,5 @@ func lintChart(path string, vals map[string]interface{}, namespace string, kubeV
return linter, errors.Wrap(err, "unable to check Chart.yaml file in chart") return linter, errors.Wrap(err, "unable to check Chart.yaml file in chart")
} }
return lint.AllWithKubeVersion(chartPath, vals, namespace, kubeVersion), nil return lint.AllWithKubeVersion(chartPath, vals, namespace, kubeVersion, ignoreFilePath), nil
} }

Loading…
Cancel
Save