Skip to content

Draft: Add HelmTemplateError exceptions for more concise errors

Gerard Hickey requested to merge helm_exception into master

While working on recent changes to some of the checkConfig code I was at times not getting adequate error messages from the RSpec output. This required me to continually run helm template manually to get the actual errors from Helm.

Now errors are a little more concise and in some cases have more relevant error messages. The following is a sample of the the error messages:

  1) Database configuration No decomposition With default configuration `database.yml` Provides only `main` stanza and uses in-chart postgresql service
     Failure/Error: raise HelmTemplateError, @stderr

     HelmTemplateError:
       Error: template: gitlab/templates/NOTES.txt:121:3: executing "gitlab/templates/NOTES.txt" at <include "gitlab.checkConfig" .>: error calling include: template: gitlab/templates/_checkConfig.tpl:64:34: executing "gitlab.checkConfig" at <include "gitlab.checkConfig.postgresql.noPasswordFile" .>: error calling include: template: gitlab/templates/_checkConfig_postgresql.tpl:28:59: executing "gitlab.checkConfig.postgresql.noPasswordFile" at <$.Values.global.psql.main>: wrong type for value; expected map[string]interface {}; got interface {}

       Use --debug flag to render out invalid YAML
     # ./spec/helm_template_helper.rb:77:in `template'
     # ./spec/helm_template_helper.rb:48:in `initialize'
     # ./spec/configuration/database_decomposition_spec.rb:46:in `new'
     # ./spec/configuration/database_decomposition_spec.rb:46:in `block (4 levels) in <top (required)>'
     # ./.bundle/ruby/2.7.0/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:123:in `block in run'
     # ./.bundle/ruby/2.7.0/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:110:in `loop'
     # ./.bundle/ruby/2.7.0/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:110:in `run'
     # ./.bundle/ruby/2.7.0/gems/rspec-retry-0.6.1/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry'
     # ./.bundle/ruby/2.7.0/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:37:in `block (2 levels) in setup'

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion.

Required

  • Merge Request Title and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Tests added
  • Integration tests added to GitLab QA
  • Equivalent MR/issue for omnibus-gitlab opened
Edited by Steven Wilson

Merge request reports